diff -pruN 22.4.3+ds1-1/CMakeLists.txt 22.5.1+ds1-1/CMakeLists.txt
--- 22.4.3+ds1-1/CMakeLists.txt	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/CMakeLists.txt	2022-07-19 15:03:31.000000000 +0000
@@ -21,7 +21,7 @@
 cmake_minimum_required(VERSION 3.5)
 project(IntelMediaDriver)
 
-set(MEDIA_VERSION "22.4.3${MEDIA_VERSION_EXTRA}" CACHE STRING "" FORCE)
+set(MEDIA_VERSION "22.5.1${MEDIA_VERSION_EXTRA}" CACHE STRING "" FORCE)
 
 include(os_release_info.cmake)
 
diff -pruN 22.4.3+ds1-1/debian/changelog 22.5.1+ds1-1/debian/changelog
--- 22.4.3+ds1-1/debian/changelog	2022-06-16 20:48:53.000000000 +0000
+++ 22.5.1+ds1-1/debian/changelog	2022-08-02 19:18:24.000000000 +0000
@@ -1,3 +1,9 @@
+intel-media-driver-non-free (22.5.1+ds1-1) unstable; urgency=medium
+
+  * New upstream version 22.5.1+ds1
+
+ -- Sebastian Ramacher <sramacher@debian.org>  Tue, 02 Aug 2022 21:18:24 +0200
+
 intel-media-driver-non-free (22.4.3+ds1-1) unstable; urgency=medium
 
   * New upstream version 22.4.3+ds1
diff -pruN 22.4.3+ds1-1/docs/media_features.md 22.5.1+ds1-1/docs/media_features.md
--- 22.4.3+ds1-1/docs/media_features.md	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/docs/media_features.md	2022-07-19 15:03:31.000000000 +0000
@@ -16,13 +16,13 @@
 |            | Max Res. | 16k            | 8k             | 8k             | 8k             | 8k   | 8k   | 8k   |      |
 | HEVC 10bit | Output   | P010/Y210/Y410 | P010/Y210/Y410 | P010/Y210/Y410 | P010/Y210/Y410 | P010 | P010 |      |      |
 |            | Max Res. | 16k            | 8k             | 8k             | 8k             | 8k   | 8k   |      |      |
-| HEVC 12bit | Output   | P016/Y216/Y416 | P016/Y216/Y416 | P016/Y216/Y416 |                |      |      |      |      |
+| HEVC 12bit | Output** | P016/Y216/Y416 | P016/Y216/Y416 | P016/Y216/Y416 |                |      |      |      |      |
 |            | Max Res. | 16k            | 8k             | 8k             |                |      |      |      |      |
 | VP9 8bit   | Output   | NV12/AYUV      | NV12/AYUV      | NV12/AYUV      | NV12/AYUV      | NV12 | NV12 |      |      |
 |            | Max Res. | 16k            | 8k             | 8k             | 8k             | 8k   | 4k   |      |      |
 | VP9 10bit  | Output   | P010/Y410      | P010/Y410      | P010/Y410      | P010/Y410      | P010 |      |      |      |
 |            | Max Res. | 16k            | 8k             | 8k             | 8k             | 8k   |      |      |      |
-| VP9 12bit  | Output   | P016/Y216/Y416 | P016/Y216/Y416 | P016/Y216/Y416 |                |      |      |      |      |
+| VP9 12bit  | Output** | P016/Y216/Y416 | P016/Y216/Y416 | P016/Y216/Y416 |                |      |      |      |      |
 |            | Max Res. | 16k            | 8k             | 8k             |                |      |      |      |      |
 | AV1 8bit   | Output   | NV12           | NV12           | NV12           |                |      |      |      |      |
 |            | Max Res. | 16k            | 8k             | 8k             |                |      |      |      |      |
@@ -30,6 +30,7 @@
 |            | Max Res. | 16k            | 8k             | 8k             |
 
 - \* VP8 is only supported on TGL platform
+- \** HVEC/VP9 12bit use P016/Y216/Y416 with the least significant 4 bits are set to zero
 
 ### JPEG Decoding Format Support
 | Input Format                                         | Output Format | Max resolution | Supported Platforms |
@@ -119,4 +120,4 @@ Video processing has various feature fil
 * SFC: Chroma Sitting, CSC, Mirroring, Rotation, Scaling, Sharpening, Color Fill
 * EU (Media Kernel or Shader): Blending, CSC, Rotation, Scaling, Color Fill
 
-##### Resolution definition: 2k=2048x2048, 4k=4096x4096, 8k=8192x8192, 16k=16384x16384
\ No newline at end of file
+##### Resolution definition: 2k=2048x2048, 4k=4096x4096, 8k=8192x8192, 16k=16384x16384
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common_av1.h 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common_av1.h
--- 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common_av1.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common_av1.h	2022-07-19 15:03:31.000000000 +0000
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2020-2021, Intel Corporation
+* Copyright (c) 2020-2022, Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
@@ -179,15 +179,14 @@ enum CodecAv1ReferenceMode
 
 //!
 //! \enum CodecAv1TxType
-//! AV1 transformation type, defined in AOM
+//! AV1 transformation type, defined in AOM errata.1
 //!
 enum class CodecAv1TxType
 {
-    ONLY_4X4    = 0,
-    ALLOW_8X8   = 1,
-    ALLOW_16X16 = 2,
-    ALLOW_32X32 = 3,
-    SELECTABLE  = 4,
+    ONLY_4X4        = 0,    // use only 4x4 transform
+    TX_MODE_LARGEST = 1,    // transform size is the largest possible for pu size
+    TX_MODE_SELECT  = 2,    // transform specified for each block
+    TX_MODES,
 };
 
 //!
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common_encode.h 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common_encode.h
--- 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common_encode.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common_encode.h	2022-07-19 15:03:31.000000000 +0000
@@ -35,11 +35,12 @@
 #define CODEC_CURR_TRACKED_BUFFER           CODEC_NUM_TRACKED_BUFFERS
 
 //BRC
-#define BRC_IMG_STATE_SIZE_PER_PASS         128
-#define BRC_IMG_STATE_SIZE_PER_PASS_G10     144
-#define BRC_IMG_STATE_SIZE_PER_PASS_G11     192
-#define BRC_MAX_BITRATE_RATIO               1.5  // maxBitrate = BRC_MAX_BITRATE_RATIO * targetBitrate
-#define BRC_DEFAULT_CPB_IN_SEC              2    // bufferSize = BRC_DEFAULT_CPB_IN_SEC * maxBitrate
+#define BRC_IMG_STATE_SIZE_PER_PASS                128
+#define BRC_IMG_STATE_SIZE_PER_PASS_G10            144
+#define BRC_IMG_STATE_SIZE_PER_PASS_G11            192
+#define BRC_MAX_BITRATE_RATIO                      1.5  // maxBitrate = BRC_MAX_BITRATE_RATIO * targetBitrate
+#define BRC_DEFAULT_CPB_IN_SEC                     2    // bufferSize = BRC_DEFAULT_CPB_IN_SEC * maxBitrate
+#define CODECHAL_ENCODE_SCENE_CHANGE_DETECTED_MASK 0xffff
 
 // Quality/Performance differentiators for HSW AVC Encode
 #define NUM_TARGET_USAGE_MODES 8
@@ -86,7 +87,9 @@
 #define SCALE_FACTOR_16x    16
 #define SCALE_FACTOR_32x    32
 
-#define CODECHAL_VP9_MB_CODE_SIZE                   204
+// Encode Sizes
+#define CODECHAL_ENCODE_STATUS_NUM         512
+#define CODECHAL_ENCODE_SLICESIZE_BUF_SIZE (4960 * sizeof(uint16_t))
 
 typedef struct tagENCODE_RECT
 {
@@ -430,6 +433,99 @@ typedef enum _CODEC_SLICE_STRUCTS
     // 5 - 7 are Reserved
 } CODEC_SLICE_STRUCTS;
 
+enum
+{
+    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_PHASE1_KERNEL = CODECHAL_ENCODE_PERFTAG_CALL_MBENC_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_PHASE2_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_SCALING_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_INTRA_DIST,
+    CODECHAL_ENCODE_PERFTAG_CALL_ME_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_BRC_INIT_RESET,
+    CODECHAL_ENCODE_PERFTAG_CALL_BRC_UPDATE,
+    CODECHAL_ENCODE_PERFTAG_CALL_BRC_COPY,
+    CODECHAL_ENCODE_PERFTAG_CALL_PAK_ENGINE,
+    CODECHAL_ENCODE_PERFTAG_CALL_PAK_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_PAK_PHASE1_KERNEL = CODECHAL_ENCODE_PERFTAG_CALL_PAK_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_PAK_PHASE2_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_UPSCALING,
+    CODECHAL_ENCODE_PERFTAG_CALL_DEBLOCKING,
+    CODECHAL_ENCODE_PERFTAG_CALL_WP_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_32X32_PU_MD,
+    CODECHAL_ENCODE_PERFTAG_CALL_32X32_B_IC,
+    CODECHAL_ENCODE_PERFTAG_CALL_16X16_PU_MD,
+    CODECHAL_ENCODE_PERFTAG_CALL_16X16_SAD,
+    CODECHAL_ENCODE_PERFTAG_CALL_8X8_PU,
+    CODECHAL_ENCODE_PERFTAG_CALL_8X8_FMODE,
+    CODECHAL_ENCODE_PERFTAG_CALL_BRC_UPDATE_LCU,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_I_32x32,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_I_16x16,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_P,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_TX,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_RECON_LUMA,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_RECON_CHROMA,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_RECON_LUMA_32x32,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_RECON_INTRA_LUMA,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_RECON_INTRA_CHROMA,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_DEBLOCK_MASK,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_DEBLOCK_LUMA,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_DEBLOCK_CHROMA,
+    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_MC,
+    CODECHAL_ENCODE_PERFTAG_CALL_PREPROC_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_DS_CONVERSION_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_SCOREBOARD,
+    CODECHAL_ENCODE_PERFTAG_CALL_SFD_KERNEL,
+    CODECHAL_ENCODE_PERFTAG_CALL_PAK_ENGINE_SECOND_PASS,
+    CODECHAL_ENCODE_PERFTAG_CALL_BRC_UPDATE_SECOND_PASS,
+    CODECHAL_ENCODE_PERFTAG_CALL_HEVC_LA_UPDATE,
+    CODECHAL_ENCODE_PERFTAG_CALL_VP9_HPU,
+    CODECHAL_ENCODE_PERFTAG_CALL_VP9_HPU_SECOND_PASS
+};
+
+typedef enum _CODECHAL_ENCODE_FUNCTION_ID
+{
+    CODECHAL_ENCODE_ENC_ID           = 0x100,
+    CODECHAL_ENCODE_PAK_ID           = 0x101,
+    CODECHAL_ENCODE_ENC_PAK_ID       = 0x102,
+    CODECHAL_ENCODE_VPP_ID           = 0x103,
+    CODECHAL_ENCODE_FORMAT_COUNT_ID  = 0x104,
+    CODECHAL_ENCODE_FORMATS_ID       = 0x105,
+    CODECHAL_ENCODE_ENC_CTRL_CAPS_ID = 0x106,
+    CODECHAL_ENCODE_ENC_CTRL_GET_ID  = 0x107,
+    CODECHAL_ENCODE_ENC_CTRL_SET_ID  = 0x108,
+    CODECHAL_ENCODE_MBDATA_LAYOUT_ID = 0x109,
+    CODECHAL_ENCODE_FEI_PRE_ENC_ID   = 0x10A,
+    CODECHAL_ENCODE_FEI_ENC_ID       = 0x10B,
+    CODECHAL_ENCODE_FEI_PAK_ID       = 0x10C,
+    CODECHAL_ENCODE_FEI_ENC_PAK_ID   = 0x10D,
+    CODECHAL_ENCODE_QUERY_STATUS_ID  = 0x121
+} CODECHAL_ENCODE_FUNCTION_ID;
+
+//!
+//! \struct    HwCounter
+//! \brief     Hardware counter
+//!
+struct HwCounter
+{
+    uint64_t IV;         // Big-Endian IV
+    uint64_t Count;      // Big-Endian Block Count
+};
+
+//!
+//! \struct CodechalTileInfo
+//! \brief Tile info report to application
+//!
+struct CodechalTileInfo
+{
+    uint16_t    TileRowNum;
+    uint16_t    TileColNum;
+    uint32_t    TileBitStreamOffset;
+    uint32_t    TileSizeInBytes;
+
+    uint32_t    reserved;
+    HwCounter   HWCounterValue;
+};
+
 //FEI Encode Macros
 #define CodecHalIsFeiEncode(codecFunction)              \
     ( codecFunction == CODECHAL_FUNCTION_FEI_PRE_ENC ||  \
@@ -491,4 +587,13 @@ typedef enum _CODEC_SLICE_STRUCTS
 #define CODECHAL_ENCODE_MODE_BIT_OFFSET     ((uint32_t)(log((double)CODECHAL_ENCODE_MODE_AVC)/log(2.)))
 #define CODECHAL_ENCODE_MODE_BIT_MASK       (( 1L << CODECHAL_ENCODE_MODE_BIT_OFFSET) - 1 )
 
+template<typename ValueType>
+static ValueType SwapEndianness(ValueType value)
+{
+    uint8_t*    startLocation = reinterpret_cast<uint8_t*>(&value);
+    uint8_t*    endLocation = startLocation + sizeof(ValueType);
+    std::reverse(startLocation, endLocation);
+    return value;
+}
+
 #endif  // __CODEC_DEF_COMMON_ENCODE_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common.h 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common.h
--- 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_common.h	2022-07-19 15:03:31.000000000 +0000
@@ -76,6 +76,12 @@
 #define INVALID_TYPE    10 // keep at end
 
 #define CODECHAL_GET_ARRAY_LENGTH(a)           (sizeof(a) / sizeof(a[0]))
+#define CODECHAL_CACHELINE_SIZE                 64
+#define CODECHAL_PAGE_SIZE                      0x1000
+
+// Params for Huc
+#define HUC_DMEM_OFFSET_RTOS_GEMS                  0x2000
+#define VDBOX_HUC_VDENC_BRC_INIT_KERNEL_DESCRIPTOR 4
 
 /*! \brief Flags for various picture properties.
 */
@@ -191,9 +197,11 @@ enum CODECHAL_MODE
     CODECHAL_ENCODE_MODE_AV1                = 24,
     CODECHAL_NUM_ENCODE_MODES               = 8,
 
-    CODECHAL_NUM_MODES                      = 25,   // Use the value for the last encode mode to determine this
-    CODECHAL_UNSUPPORTED_MODE               = 25,
-    CODECHAL_MODE_MAX                       = 25
+    CODECHAL_Rsvd                           = 25,
+    CODECHAL_NUM_MODES                      = 26,   // Use the value for the last encode mode to determine this
+    CODECHAL_UNSUPPORTED_MODE               = 26,
+    CODECHAL_MODE_MAX                       = 26
+
 };
 
 // Slice group mask
@@ -312,6 +320,36 @@ struct _CODEC_REF_LIST
     };
 };
 
+//!
+//! \struct    CodechalHucStreamoutParams
+//! \brief     Codechal Huc streamout parameters
+//!
+struct CodechalHucStreamoutParams
+{
+    CODECHAL_MODE       mode;
+
+    // Indirect object addr command params
+    PMOS_RESOURCE       dataBuffer;
+    uint32_t            dataSize;              // 4k aligned
+    uint32_t            dataOffset;            // 4k aligned
+    PMOS_RESOURCE       streamOutObjectBuffer;
+    uint32_t            streamOutObjectSize;   // 4k aligned
+    uint32_t            streamOutObjectOffset; //4k aligned
+
+    // Stream object params
+    uint32_t            indStreamInLength;
+    uint32_t            inputRelativeOffset;
+    uint32_t            outputRelativeOffset;
+
+    // Segment Info
+    void               *segmentInfo;
+
+    // Indirect Security State
+    MOS_RESOURCE        hucIndState;
+    uint32_t            curIndEntriesNum;
+    uint32_t            curNumSegments;
+};
+
 /*! \brief High level codec functionality
 */
 typedef enum _CODECHAL_FUNCTION
@@ -403,6 +441,74 @@ typedef enum _CODECHAL_CHROMA_SUBSAMPLIN
     CODECHAL_CHROMA_SUBSAMPLING_BOTTOM_LEFT
 } CODECHAL_CHROMA_SUBSAMPLING;
 
+typedef enum _CODECHAL_MEDIA_STATE_TYPE
+{
+    CODECHAL_MEDIA_STATE_OLP                                = 0,
+    CODECHAL_MEDIA_STATE_ENC_NORMAL                         = 1,
+    CODECHAL_MEDIA_STATE_ENC_PERFORMANCE                    = 2,
+    CODECHAL_MEDIA_STATE_ENC_QUALITY                        = 3,
+    CODECHAL_MEDIA_STATE_ENC_I_FRAME_DIST                   = 4,
+    CODECHAL_MEDIA_STATE_32X_SCALING                        = 5,
+    CODECHAL_MEDIA_STATE_16X_SCALING                        = 6,
+    CODECHAL_MEDIA_STATE_4X_SCALING                         = 7,
+    CODECHAL_MEDIA_STATE_32X_ME                             = 8,
+    CODECHAL_MEDIA_STATE_16X_ME                             = 9,
+    CODECHAL_MEDIA_STATE_4X_ME                              = 10,
+    CODECHAL_MEDIA_STATE_BRC_INIT_RESET                     = 11,
+    CODECHAL_MEDIA_STATE_BRC_UPDATE                         = 12,
+    CODECHAL_MEDIA_STATE_BRC_BLOCK_COPY                     = 13,
+    CODECHAL_MEDIA_STATE_HYBRID_PAK_P1                      = 14,
+    CODECHAL_MEDIA_STATE_HYBRID_PAK_P2                      = 15,
+    CODECHAL_MEDIA_STATE_ENC_I_FRAME_CHROMA                 = 16,
+    CODECHAL_MEDIA_STATE_ENC_I_FRAME_LUMA                   = 17,
+    CODECHAL_MEDIA_STATE_MPU_FHB                            = 18,
+    CODECHAL_MEDIA_STATE_TPU_FHB                            = 19,
+    CODECHAL_MEDIA_STATE_PA_COPY                            = 20,
+    CODECHAL_MEDIA_STATE_PL2_COPY                           = 21,
+    CODECHAL_MEDIA_STATE_ENC_ADV                            = 22,
+    CODECHAL_MEDIA_STATE_2X_SCALING                         = 23,
+    CODECHAL_MEDIA_STATE_32x32_PU_MODE_DECISION             = 24,
+    CODECHAL_MEDIA_STATE_16x16_PU_SAD                       = 25,
+    CODECHAL_MEDIA_STATE_16x16_PU_MODE_DECISION             = 26,
+    CODECHAL_MEDIA_STATE_8x8_PU                             = 27,
+    CODECHAL_MEDIA_STATE_8x8_PU_FMODE                       = 28,
+    CODECHAL_MEDIA_STATE_32x32_B_INTRA_CHECK                = 29,
+    CODECHAL_MEDIA_STATE_HEVC_B_MBENC                       = 30,
+    CODECHAL_MEDIA_STATE_RESET_VLINE_STRIDE                 = 31,
+    CODECHAL_MEDIA_STATE_HEVC_B_PAK                         = 32,
+    CODECHAL_MEDIA_STATE_HEVC_BRC_LCU_UPDATE                = 33,
+    CODECHAL_MEDIA_STATE_ME_VDENC_STREAMIN                  = 34,
+    CODECHAL_MEDIA_STATE_VP9_ENC_I_32x32                    = 35,
+    CODECHAL_MEDIA_STATE_VP9_ENC_I_16x16                    = 36,
+    CODECHAL_MEDIA_STATE_VP9_ENC_P                          = 37,
+    CODECHAL_MEDIA_STATE_VP9_ENC_TX                         = 38,
+    CODECHAL_MEDIA_STATE_VP9_DYS                            = 39,
+    CODECHAL_MEDIA_STATE_VP9_PAK_LUMA_RECON                 = 40,
+    CODECHAL_MEDIA_STATE_VP9_PAK_CHROMA_RECON               = 41,
+    CODECHAL_MEDIA_STATE_VP9_PAK_DEBLOCK_MASK               = 42,
+    CODECHAL_MEDIA_STATE_VP9_PAK_LUMA_DEBLOCK               = 43,
+    CODECHAL_MEDIA_STATE_VP9_PAK_CHROMA_DEBLOCK             = 44,
+    CODECHAL_MEDIA_STATE_VP9_PAK_MC_PRED                    = 45,
+    CODECHAL_MEDIA_STATE_VP9_PAK_P_FRAME_LUMA_RECON         = 46,
+    CODECHAL_MEDIA_STATE_VP9_PAK_P_FRAME_LUMA_RECON_32x32   = 47,
+    CODECHAL_MEDIA_STATE_VP9_PAK_P_FRAME_CHROMA_RECON       = 48,
+    CODECHAL_MEDIA_STATE_VP9_PAK_P_FRAME_INTRA_LUMA_RECON   = 49,
+    CODECHAL_MEDIA_STATE_VP9_PAK_P_FRAME_INTRA_CHROMA_RECON = 50,
+    CODECHAL_MEDIA_STATE_PREPROC                            = 51,
+    CODECHAL_MEDIA_STATE_ENC_WP                             = 52,
+    CODECHAL_MEDIA_STATE_HEVC_I_MBENC                       = 53,
+    CODECHAL_MEDIA_STATE_CSC_DS_COPY                        = 54,
+    CODECHAL_MEDIA_STATE_2X_4X_SCALING                      = 55,
+    CODECHAL_MEDIA_STATE_HEVC_LCU64_B_MBENC                 = 56,
+    CODECHAL_MEDIA_STATE_MB_BRC_UPDATE                      = 57,
+    CODECHAL_MEDIA_STATE_STATIC_FRAME_DETECTION             = 58,
+    CODECHAL_MEDIA_STATE_HEVC_ROI                           = 59,
+    CODECHAL_MEDIA_STATE_SW_SCOREBOARD_INIT                 = 60,
+    CODECHAL_NUM_MEDIA_STATES                               = 61
+} CODECHAL_MEDIA_STATE_TYPE;
+C_ASSERT(CODECHAL_NUM_MEDIA_STATES == CODECHAL_MEDIA_STATE_SW_SCOREBOARD_INIT + 1);  //!< update this and add new entry in the default SSEU table for each platform()
+
+
 #define CODECHAL_OFFSETOF(TYPE, ELEMENT)                    ((size_t)&(((TYPE *)0)->ELEMENT))
 #define CODECHAL_OFFSETOF_IN_DW(TYPE, ELEMENT)              (CODECHAL_OFFSETOF(TYPE, ELEMENT) >> 2)
 #define CODECHAL_ADDROF_TYPE(TYPE, ELEMENT, ELEMENT_ADDR)   ((TYPE *)((uint8_t *)(ELEMENT_ADDR) - CODECHAL_OFFSETOF(TYPE, ELEMENT)))
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode_avc.h 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode_avc.h
--- 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode_avc.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode_avc.h	2022-07-19 15:03:31.000000000 +0000
@@ -30,6 +30,7 @@
 #include "codec_def_common_avc.h"
 #include "codec_def_common_encode.h"
 #include "codec_def_common.h"
+#include "codec_def_encode.h"
 
 #define CODEC_AVC_NUM_MAX_DIRTY_RECT        4
 #define CODEC_AVC_NUM_QP                    52
@@ -60,6 +61,12 @@
 #define CODECHAL_ENCODE_AVC_ROI_FRAME_HEIGHT_SCALE_FACTOR   16
 #define CODECHAL_ENCODE_AVC_ROI_FIELD_HEIGHT_SCALE_FACTOR   32
 #define CODECHAL_ENCODE_AVC_MAX_ROI_NUMBER                  4
+#define CODECHAL_ENCODE_AVC_MAX_SLICE_QP                    (CODEC_AVC_NUM_QP - 1) // 0 - 51 inclusive
+#define CODECHAL_ENCODE_AVC_MAX_ICQ_QUALITYFACTOR           51
+#define CODECHAL_ENCODE_AVC_MIN_ICQ_QUALITYFACTOR           1
+#define CODECHAL_ENCODE_AVC_MAX_SLICES_SUPPORTED            256
+#define CODECHAL_DEBUG_ENCODE_AVC_NAL_START_CODE_SEI        0x00000106
+#define CODECHAL_DEBUG_ENCODE_AVC_NAL_START_CODE_PPS        0x00000128
 
 typedef struct _CODECHAL_ENCODE_AVC_ROUNDING_PARAMS
 {
@@ -1207,4 +1214,78 @@ struct CodecEncodeAvcFeiPicParams
     uint32_t                    dwNumPasses;     //number of QPs
     uint8_t                    *pDeltaQp;        //list of detla QPs
 };
+
+typedef struct _CODECHAL_ENCODE_AVC_PACK_PIC_HEADER_PARAMS
+{
+    PBSBuffer                               pBsBuffer;
+    PCODEC_AVC_ENCODE_PIC_PARAMS            pPicParams;     // pAvcPicParams[ucPPSIdx]
+    PCODEC_AVC_ENCODE_SEQUENCE_PARAMS       pSeqParams;     // pAvcSeqParams[ucSPSIdx]
+    PCODECHAL_ENCODE_AVC_VUI_PARAMS         pAvcVuiParams;
+    PCODEC_AVC_IQ_MATRIX_PARAMS             pAvcIQMatrixParams;
+    PCODECHAL_NAL_UNIT_PARAMS               *ppNALUnitParams;
+    CodechalEncodeSeiData*                  pSeiData;
+    uint32_t                                dwFrameHeight;
+    uint32_t                                dwOriFrameHeight;
+    uint16_t                                wPictureCodingType;
+    bool                                    bNewSeq;
+    bool                                   *pbNewPPSHeader;
+    bool                                   *pbNewSeqHeader;
+} CODECHAL_ENCODE_AVC_PACK_PIC_HEADER_PARAMS, *PCODECHAL_ENCODE_AVC_PACK_PIC_HEADER_PARAMS;
+
+typedef struct _CODECHAL_ENCODE_AVC_VALIDATE_NUM_REFS_PARAMS
+{
+    PCODEC_AVC_ENCODE_SEQUENCE_PARAMS       pSeqParams;     // pAvcSeqParams[ucSPSIdx]
+    PCODEC_AVC_ENCODE_PIC_PARAMS            pPicParams;
+    PCODEC_AVC_ENCODE_SLICE_PARAMS          pAvcSliceParams;
+    uint16_t                                wPictureCodingType;
+    uint16_t                                wPicHeightInMB;
+    uint16_t                                wFrameFieldHeightInMB;
+    bool                                    bFirstFieldIPic;
+    bool                                    bVDEncEnabled;
+    bool                                    bPAKonly;
+} CODECHAL_ENCODE_AVC_VALIDATE_NUM_REFS_PARAMS, *PCODECHAL_ENCODE_AVC_VALIDATE_NUM_REFS_PARAMS;
+
+typedef struct _CODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS
+{
+    uint16_t  wPictureCodingType;
+    uint8_t   ucTargetUsage;
+    uint8_t   ucQP;
+    bool      bBrcEnabled;
+    bool      bVdEncEnabled;
+} CODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS, *PCODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS;
+
+typedef struct _CODECHAL_ENCODE_AVC_TQ_PARAMS
+{
+    uint32_t    dwTqEnabled;
+    uint32_t    dwTqRounding;
+} CODECHAL_ENCODE_AVC_TQ_PARAMS, *PCODECHAL_ENCODE_AVC_TQ_PARAMS;
+
+//!
+//! \enum   TrellisSetting
+//! \brief  Indicate the different Trellis Settings
+//!
+enum TrellisSetting
+{
+    trellisInternal = 0,
+    trellisDisabled = 1,
+    trellisEnabledI = 2,
+    trellisEnabledP = 4,
+    trellisEnabledB = 8
+};
+
+typedef struct _CODECHAL_ENCODE_AVC_PACK_SLC_HEADER_PARAMS
+{
+    PBSBuffer                               pBsBuffer;
+    PCODEC_AVC_ENCODE_PIC_PARAMS            pPicParams;     // pAvcPicParams[ucPPSIdx]
+    PCODEC_AVC_ENCODE_SEQUENCE_PARAMS       pSeqParams;     // pAvcSeqParams[ucSPSIdx]
+    PCODEC_AVC_ENCODE_SLICE_PARAMS          pAvcSliceParams;
+    PCODEC_REF_LIST                         *ppRefList;
+    CODEC_PICTURE                           CurrPic;
+    CODEC_PICTURE                           CurrReconPic;
+    CODEC_AVC_ENCODE_USER_FLAGS             UserFlags;
+    CODECHAL_ENCODE_AVC_NAL_UNIT_TYPE       NalUnitType;
+    uint16_t                                wPictureCodingType;
+    bool                                    bVdencEnabled;
+} CODECHAL_ENCODE_AVC_PACK_SLC_HEADER_PARAMS, *PCODECHAL_ENCODE_AVC_PACK_SLC_HEADER_PARAMS;
+
 #endif  // __CODEC_DEF_ENCODE_AVC_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode.h 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode.h
--- 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode.h	2022-07-19 15:03:31.000000000 +0000
@@ -28,6 +28,9 @@
 #ifndef __CODEC_DEF_ENCODE_H__
 #define __CODEC_DEF_ENCODE_H__
 #include "mos_os.h"
+#include "codec_def_common.h"
+
+#define CODECHAL_VDENC_BRC_NUM_OF_PASSES        2
 
 //!
 //! \struct CodechalEncodeSeiData
@@ -206,4 +209,75 @@ struct EncoderParams
     PMOS_RESOURCE                   m_presSetMarker             = nullptr;      //! \brief [SetMarker] Resource for SetMarker
 };
 
+//!
+//! \struct PerfTagSetting
+//! \brief  Setting of performance tags
+//!
+struct PerfTagSetting
+{
+    union
+    {
+        struct
+        {
+            uint16_t    PictureCodingType   : 2;
+            uint16_t    CallType            : 6;
+            uint16_t    Mode                : 4;
+            uint16_t                        : 4;
+        };
+        uint16_t        Value;
+    };
+};
+
+//!
+//! \enum   MbBrcSetting
+//! \brief  Indicate the MBBRC settings
+//!
+enum MbBrcSetting
+{
+    mbBrcInternal = 0,
+    mbBrcEnabled  = 1,
+    mbBrcDisabled = 2,
+};
+
+//!
+//! \struct VdencBrcPakMmio
+//! \brief  MMIO of BRC and PAK
+//!
+struct VdencBrcPakMmio
+{
+    uint32_t                dwReEncode[4];
+};
+
+//!
+//! \struct    EncodeStatusReadParams
+//! \brief     Read encode states parameters
+//!
+struct EncodeStatusReadParams
+{
+    bool          vdencBrcEnabled;
+    bool          waReadVDEncOverflowStatus;
+    uint32_t      mode ;
+
+    uint32_t      vdencBrcNumOfSliceOffset;
+    PMOS_RESOURCE *resVdencBrcUpdateDmemBufferPtr;
+
+    PMOS_RESOURCE resBitstreamByteCountPerFrame;
+    uint32_t      bitstreamByteCountPerFrameOffset;
+
+    PMOS_RESOURCE resBitstreamSyntaxElementOnlyBitCount;
+    uint32_t      bitstreamSyntaxElementOnlyBitCountOffset;
+
+    PMOS_RESOURCE resQpStatusCount;
+    uint32_t      qpStatusCountOffset;
+
+    PMOS_RESOURCE resNumSlices;
+    uint32_t      numSlicesOffset;
+
+    PMOS_RESOURCE resImageStatusMask;
+    uint32_t      imageStatusMaskOffset;
+
+    PMOS_RESOURCE resImageStatusCtrl;
+    uint32_t      imageStatusCtrlOffset;
+};
+
 #endif // !__CODEC_DEF_ENCODE_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode_hevc.h 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode_hevc.h
--- 22.4.3+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode_hevc.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/codec/shared/codec_def_encode_hevc.h	2022-07-19 15:03:31.000000000 +0000
@@ -59,6 +59,7 @@
 #define HEVC_BRC_PAK_STATISTCS_SIZE              32
 
 #define CODECHAL_VDENC_HEVC_BRC_HUC_STATUS_REENCODE_MASK     (1<<31)
+#define CODECHAL_VDENC_HEVC_BRC_HISTORY_BUF_SIZE             964
 
 #define CODECHAL_HEVC_I_SLICE          2
 #define CODECHAL_HEVC_P_SLICE          1
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/frame_tracker.h 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/frame_tracker.h
--- 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/frame_tracker.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/frame_tracker.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2019, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     frame_tracker.h
+//! \brief    Manages the multiple trackers in one place.
+//!
+
+#ifndef __FRAME_TRACKER_H__
+#define __FRAME_TRACKER_H__
+
+#include "mos_os.h"
+#include <map>
+
+#define MAX_TRACKER_NUMBER 64
+#define CHK_INDEX(index) if ((index) >= MAX_TRACKER_NUMBER) {return MOS_STATUS_NOT_ENOUGH_BUFFER; }
+
+class FrameTrackerToken;
+class FrameTrackerProducer;
+
+// C-style struct for FrameTrackerToken
+// for tokens that embeded in a struct other than a class
+// in legacy DSH code, the token is always embeded in another struct
+struct FrameTrackerTokenFlat
+{
+    FrameTrackerProducer *producer;
+    uint32_t trackers[MAX_TRACKER_NUMBER];
+    bool valid;
+    bool stick;
+};
+
+bool FrameTrackerTokenFlat_IsExpired(const FrameTrackerTokenFlat *self);
+
+static inline void FrameTrackerTokenFlat_Merge(FrameTrackerTokenFlat *self, uint32_t index, uint32_t tracker)
+{
+    if (index < MAX_TRACKER_NUMBER && tracker != 0)
+    {
+        self->trackers[index] = tracker;
+    }
+}
+
+static inline void FrameTrackerTokenFlat_Merge(FrameTrackerTokenFlat *self, const FrameTrackerTokenFlat *token)
+{
+    self->producer = token->producer;
+    for (int i = 0; i < MAX_TRACKER_NUMBER; i++)
+    {
+        if (token->trackers[i] != 0)
+        {
+            FrameTrackerTokenFlat_Merge(self, i, token->trackers[i]);
+        }
+    }
+}
+
+static inline void FrameTrackerTokenFlat_SetProducer(FrameTrackerTokenFlat *self, FrameTrackerProducer *producer)
+{
+    self->producer = producer;
+}
+
+static inline void FrameTrackerTokenFlat_Clear(FrameTrackerTokenFlat *self)
+{
+    self->stick = false;
+    MOS_ZeroMemory(self->trackers, sizeof(self->trackers));
+}
+
+static inline void FrameTrackerTokenFlat_Validate(FrameTrackerTokenFlat *self)
+{
+    self->valid = true;
+}
+
+static inline void FrameTrackerTokenFlat_Invalidate(FrameTrackerTokenFlat *self)
+{
+    self->valid = false;
+}
+
+static inline bool FrameTrackerTokenFlat_IsValid(const FrameTrackerTokenFlat *self)
+{
+    return self->valid;
+}
+
+static inline void FrameTrackerTokenFlat_Stick(FrameTrackerTokenFlat *self)
+{
+    self->stick = true;
+}
+
+class FrameTrackerToken
+{
+public:
+    FrameTrackerToken():
+        m_producer(nullptr)
+    {
+    }
+
+    ~FrameTrackerToken()
+    {
+    }
+
+    bool IsExpired();
+
+    void Merge(const FrameTrackerToken *token);
+
+    inline void Merge(uint32_t index, uint32_t tracker) {m_holdTrackers[index] = tracker; }
+
+    inline void SetProducer(FrameTrackerProducer *producer)
+    {
+        m_producer = producer;
+    }
+
+    inline void Clear() {m_holdTrackers.clear(); }
+
+protected:
+    FrameTrackerProducer *m_producer;
+    std::map<uint32_t, uint32_t> m_holdTrackers;
+};
+
+class FrameTrackerProducer
+{
+public:
+    FrameTrackerProducer();
+    ~FrameTrackerProducer();
+
+    MOS_STATUS Initialize(MOS_INTERFACE *osInterface);
+
+    int AssignNewTracker();
+
+    inline void GetLatestTrackerResource(uint32_t index, MOS_RESOURCE **resource, uint32_t *offset)
+    {
+        *resource = &m_resource;
+        *offset = index * m_trackerSize;
+    }
+    
+    inline volatile uint32_t *GetLatestTrackerAddress(uint32_t index)
+    {
+        return (uint32_t *)((uint8_t *)m_resourceData + index * m_trackerSize);
+    }
+
+    inline uint32_t GetNextTracker(uint32_t index) { return m_counters[index];}
+
+    inline MOS_STATUS StepForward(uint32_t index)
+    {
+        CHK_INDEX(index);
+        ++ m_counters[index];
+        if (m_counters[index] == 0)
+        {
+            m_counters[index] = 1;
+        }
+        return MOS_STATUS_SUCCESS;
+    }
+
+protected:
+    // indexes to assign a new tracer
+    uint32_t m_nextTrackerIndex;
+    bool m_trackerInUse[MAX_TRACKER_NUMBER];
+
+    // resource
+    static const uint32_t m_trackerSize = 8; // reserved two dwords for each tracker
+    MOS_RESOURCE m_resource;
+    uint32_t *m_resourceData;
+
+    // counters
+    uint32_t m_counters[MAX_TRACKER_NUMBER];
+
+    // interfaces
+    MOS_INTERFACE *m_osInterface;
+};
+
+
+#endif // __FRAME_TRACKER_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/heap.h 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/heap.h
--- 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/heap.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/heap.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2017, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     heap.h
+//! \brief    A heap is a buffer in graphics memory in which the driver may store information
+//! \details  Heaps are created for the client via the heap manager, through which the client
+//!           is expected to claim blocks of memory for data storage. The client has no direct
+//!           access to the heap.
+//!
+
+#ifndef __HEAP_H__
+#define __HEAP_H__
+
+#include "mos_os.h"
+#include "mos_util_debug.h"
+#include "mos_interface.h"
+
+//! Evaluates the status and returns if failure
+#define HEAP_CHK_STATUS(_stmt)                                               \
+    MOS_CHK_STATUS_RETURN(MOS_COMPONENT_HW, MOS_HW_SUBCOMP_ALL, _stmt)
+//! Checks the pointer and returns if nullptr
+#define HEAP_CHK_NULL(_ptr)                                                  \
+    MOS_CHK_NULL_RETURN(MOS_COMPONENT_HW, MOS_HW_SUBCOMP_ALL, _ptr)
+//! Asserts and prints \a _message at critical message level
+#define HEAP_ASSERTMESSAGE(_message, ...)                                                 \
+    MOS_ASSERTMESSAGE(MOS_COMPONENT_HW, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
+//! Prints \a _message at normal message level
+#define HEAP_NORMALMESSAGE(_message, ...)                                                 \
+    MOS_NORMALMESSAGE(MOS_COMPONENT_HW, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
+//! Prints \a _message at verbose message level
+#define HEAP_VERBOSEMESSAGE(_message, ...)                                                \
+    MOS_VERBOSEMESSAGE(MOS_COMPONENT_HW, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
+//! Prints the function name at function enter message level
+#define HEAP_FUNCTION_ENTER                                                               \
+    MOS_FUNCTION_ENTER(MOS_COMPONENT_HW, MOS_SUBCOMP_SELF)
+//! Prints the function name at verbose function enter message level
+#define HEAP_FUNCTION_ENTER_VERBOSE                                                       \
+    MOS_FUNCTION_ENTER_VERBOSE(MOS_COMPONENT_HW, MOS_SUBCOMP_SELF)
+
+//! \brief Generic heap for storing client written data in graphics memory
+class Heap
+{
+    friend class MemoryBlockInternal;
+    friend class MemoryBlockManager;
+
+public:
+    //!
+    //! \brief  Default constructor
+    //!         Identifier for the heap
+    //!  
+    Heap();
+
+    //!
+    //! \brief    Copy constructor
+    //!
+    Heap(const Heap&) = delete;
+
+    //!
+    //! \brief    Copy assignment operator
+    //!
+    Heap& operator=(const Heap&) = delete;
+
+    //!
+    //! \brief  Constructor
+    //! \param  [in] id
+    //!         Identifier for the heap
+    //!  
+    Heap(uint32_t id);
+    virtual ~Heap();
+
+    //!  
+    //! \brief  Dumps the contents of the heap
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!  
+    MOS_STATUS Dump();
+
+    //!
+    //! \brief  Checks heap for validity
+    //! \return bool
+    //!         true if the heap is valid and false if not
+    //!
+    bool IsValid() { return (m_size > 0); }
+
+    //!
+    //! \brief  Gets the graphics resource for the heap
+    //! \param  [out] resource
+    //!         Container for the output graphics resource
+    //! \return MOS_RESOURCE*
+    //!         Valid pointer if success, nullptr for any fail
+    //!
+    MOS_RESOURCE* GetResource()
+    {
+        HEAP_FUNCTION_ENTER_VERBOSE;
+        if (m_size && !Mos_ResourceIsNull(m_resource))
+        {
+            return m_resource;
+        }
+        HEAP_ASSERTMESSAGE("Resource is not valid");
+        return nullptr;
+    }
+
+    //!
+    //! \brief  Gets the size of the heap
+    //! \return The size of the heap \see m_size
+    //!
+    uint32_t GetSize() { return m_size; }
+
+    //!
+    //! \brief  Gets the used size of the heap
+    //! \return The amount of space used in the heaps \see m_usedSize
+    //!
+    uint32_t GetUsedSize() { return m_usedSpace; }
+
+    //!
+    //! \brief  Gets the ID for the heap
+    //! \return The Heap ID \see m_id
+    //!
+    uint32_t GetId() { return m_id; }
+
+    //!
+    //! \brief  Whether or not the heap has been marked for freeing.
+    //! \return If the heap is being freed \see m_freeInProgress
+    //!  
+    bool IsFreeInProgress() { return m_freeInProgress; }
+
+    //! \brief Invalid heap ID.
+    static const uint8_t m_invalidId = 0;
+
+    //!
+    //! \brief  Mark the heap as hardware write only heap or not
+    void SetHeapHwWriteOnly(bool isHwWriteOnly) { m_hwWriteOnly = isHwWriteOnly; }
+
+protected:
+    //!
+    //! \brief  Stores the provided OS interface in the heap
+    //! \param  [in] osInterface
+    //!         Must be valid
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!  
+    MOS_STATUS RegisterOsInterface(PMOS_INTERFACE osInterface);
+
+    //!
+    //! \brief  Allocates a graphics resource of size \a heapSize
+    //! \param  [in] heapSize
+    //!         The size of the state heap, must be non-zero
+    //! \param  [in] keepLocked
+    //!         Locks the heap when allocated and does not unlock it until it is destroyed
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!  
+    MOS_STATUS Allocate(uint32_t heapSize, bool keepLocked);
+
+    //!
+    //! \brief  Locks the heap asynchonously
+    //! \return uint8_t*
+    //!         If successful, pointer to data in the heap resource; if failed, nullptr \see m_resource
+    //!  
+    uint8_t* Lock();
+
+    //!
+    //! \brief  Unlocks the heap
+    //!  
+    void Unlock()
+    {
+        HEAP_FUNCTION_ENTER_VERBOSE;
+        if (!m_keepLocked)
+        {
+            if (m_osInterface == nullptr)
+            {
+                HEAP_ASSERTMESSAGE("Invalid m_osInterface(nullptr)");
+                return;
+            }
+
+            m_osInterface->pfnUnlockResource(m_osInterface, m_resource);
+        }
+    }
+
+    //!
+    //! \brief  Prepares the heap for being freed which will occur when all blocks are
+    //!         no longer in use.
+    //!  
+    void PrepareForFree()
+    {
+        HEAP_FUNCTION_ENTER;
+        m_freeInProgress = true;
+    }
+
+    //!
+    //! \brief  Adjusts the free space in the heap. 
+    //! \param  [in] addedSpace
+    //!         Space to be added and subtracted from the free and used space
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //! 
+    MOS_STATUS AdjustFreeSpace(uint32_t addedSpace);
+
+    //!
+    //! \brief  Adjusts the used space in the heap. 
+    //! \param  [in] addedSpace
+    //!         Space to be added and subtracted from the free and used space
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //! 
+    MOS_STATUS AdjustUsedSpace(uint32_t addedSpace);
+
+private:
+    //! \brief Indicates that the heap is in the process of being freed
+    bool m_freeInProgress = false;
+    bool m_keepLocked = false;          //!< Indictaes that heap is kept locked until freed.
+    PMOS_RESOURCE m_resource = nullptr; //!< Graphics resource for the heap.
+    uint32_t m_size = 0;                //!< The size of the heap.
+    //! \brief   Pointer to the locked heap data.
+    //! \details This pointer is only valid if the heap is locked always
+    uint8_t *m_lockedHeap = nullptr;
+    uint32_t m_freeSpace = 0;           //!< The amount of space available in the heap
+    uint32_t m_usedSpace = 0;           //!< The amount of used space within the heap
+    //! \brief OS interface used for managing graphics resources
+    PMOS_INTERFACE m_osInterface = nullptr;
+    //! \brief unique identifier for the heap within the heap manager
+    uint32_t m_id = m_invalidId;
+    bool m_hwWriteOnly = false;            //!< Indictaes that heap is used by hardware write only.
+};
+#endif // __HEAP_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/heap_manager.h 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/heap_manager.h
--- 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/heap_manager.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/heap_manager.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2017, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     heap_manager.h
+//! \brief    The client facing interface for handling heaps.
+//!
+
+#ifndef __HEAP_MANAGER_H__
+#define __HEAP_MANAGER_H__
+
+#include "memory_block_manager.h"
+
+class FrameTrackerProducer;
+
+//! \brief Client accessible manager for heaps.
+class HeapManager
+{
+
+public:
+    //! \brief Expected behavior when space is not available in the heap(s)
+    enum Behavior
+    {
+        wait = 0,           //<! Waits for space to become available.
+        extend,             //<! Allocates a new heap of the existing size + the default extend heap size.
+        destructiveExtend,  //<! Performs the same action as extend and marks the old heap for delete.
+        waitAndExtend,      //<! Waits for a fixed amount of time and then performs an extend if a timeout occurs.
+        clientControlled    //<! If space is not available, heap manager returns so client can decide what to do
+    };
+
+    HeapManager()
+    {
+        HEAP_FUNCTION_ENTER;
+    }
+    virtual ~HeapManager();
+
+    //!
+    //! \brief  Acquires space within the heap(s)
+    //! \param  [in] params
+    //!         Parameters describing the requested space
+    //! \param  [out] blocks
+    //!         A vector containing the memory blocks allocated
+    //! \param  [out] spaceNeeded
+    //!         Amount of space that the heap(s) are short of to complete space acquisition
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS AcquireSpace(
+        MemoryBlockManager::AcquireParams &params,
+        std::vector<MemoryBlock> &blocks,
+        uint32_t &spaceNeeded);
+
+    //!
+    //! \brief  Indicates that the client is done editing the blocks
+    //! \param  [in] blocks
+    //!         Blocks to be submitted
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS SubmitBlocks(std::vector<MemoryBlock> &blocks)
+    {
+        return m_blockManager.SubmitBlocks(blocks);
+    }
+
+    //!
+    //! \brief   Makes a block available in the heap.
+    //! \details Expected to be used only when the behavior selected in HeapManager is client
+    //!          controlled--the client wants direct control over what is removed from the heap
+    //!          (static blocks would be used in this case).
+    //! \param   [in] block
+    //!          Block to be removed
+    //! \return  MOS_STATUS
+    //!          MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS ClearSpace(MemoryBlock &block);
+
+    //!
+    //! \brief  Registers the tracker data to be used for determining whether a
+    //!         memory block is available.
+    //! \param  [in] trackerData
+    //!         Must be valid; pointer to tracker data. \see MemoryBlockManager::m_trackerData.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS RegisterTrackerResource(uint32_t *trackerData);
+
+    //!
+    //! \brief  Registers the tracker producer to be used for determining whether a
+    //!         memory block is available. This function has a higher priority than
+    //!         RegisterTrackerResource, so if it is called, the trackerResource will
+    //!         be useless.
+    //! \param  [in] trackerProducer
+    //!         Must be valid; pointer to trackerProducer.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS RegisterTrackerProducer(FrameTrackerProducer *trackerProducer);
+
+    //!
+    //! \brief  Updates the default behavior of the heap manager
+    //! \param  [in] behavior
+    //!         Expected behavior of the heap mamanger
+    //!
+    void SetDefaultBehavior(Behavior behavior)
+    { 
+        HEAP_FUNCTION_ENTER;
+        if (behavior > clientControlled)
+        {
+            behavior = wait;
+        }
+        m_behavior = behavior;
+    }
+
+    //!
+    //! \brief  Updates the initial heap size either for first allocation or for extension
+    //! \param  [in] size
+    //!         Updates the current heap size, must be non-zero. \see m_currHeapSize
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS SetInitialHeapSize(uint32_t size);
+
+    //!
+    //! \brief  Updates the extend heap size when the behavior is not to wait. \see m_behavior \see Behavior::wait
+    //! \param  [in] size
+    //!         Updates the extend heap size, must be non-zero. \see m_extendHeapSize
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS SetExtendHeapSize(uint32_t size);
+
+    //!
+    //! \brief  Stores the provided OS interface in the heap
+    //! \param  [in] osInterface
+    //!         Must be valid
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!  
+    MOS_STATUS RegisterOsInterface(PMOS_INTERFACE osInterface);
+
+    //!
+    //! \brief  Indicates the total size of all managed heaps
+    //! \return The size of all heaps managed \see m_totalSizeOfHeaps
+    //!  
+    uint32_t GetTotalSize();
+
+    //!
+    //! \brief  Indicates the size of heap extensions
+    //! \return The size by which heaps are extended by \see m_extendHeapSize
+    //!  
+    uint32_t GetExtendSize()
+    {
+        HEAP_FUNCTION_ENTER;
+        return m_extendHeapSize;
+    }
+
+    //!
+    //! \brief   All heaps allocated are locked and kept locked for their lifetimes
+    //! \details May only be set before any heaps are allocated.
+    //! \return  MOS_STATUS
+    //!          MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS LockHeapsOnAllocate()
+    {
+        HEAP_FUNCTION_ENTER;
+        return m_blockManager.LockHeapsOnAllocate();
+    }
+
+    //!
+    //! \brief  Mark the heap as hardware write only heap or not
+    void SetHwWriteOnlyHeap(bool isHwWriteOnlyHeap) { m_hwWriteOnlyHeap = isHwWriteOnlyHeap; }
+
+private:
+    //!
+    //! \brief  Allocates a heap of requested size
+    //! \param  [in] size
+    //!         Size of the heap to be allocated
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS AllocateHeap(uint32_t size);
+
+    //!
+    //! \brief  Free or attempts to free a heap
+    //!
+    void FreeHeap();
+
+    //!
+    //! \brief  Wait for for space to be available in the heap
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS Wait();
+
+    //!
+    //! \brief  If space may not be acquired, behave according to the current specified behavior.
+    //!         \see m_behavior \see MemoryBlockManager::AcquireSpace
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS BehaveWhenNoSpace();
+
+    //! \brief Alignment used for the heap size during allocation
+    static const uint32_t m_heapAlignment = MOS_PAGE_SIZE;
+    //! \brief Timeout in milliseconds for wait, currently fixed
+    static const uint32_t m_waitTimeout = 100;
+    //! \brief Wait increment in milliseconds, currently fixed
+    static const uint32_t m_waitIncrement = 10;
+
+    //! \brief Memory block manager for the heap(s)
+    MemoryBlockManager m_blockManager;
+    //! \brief The default behavior when space is not found in any of the heaps.
+    Behavior m_behavior = Behavior::wait;
+    //! \brief Current heap ID
+    uint32_t m_currHeapId = Heap::m_invalidId;
+    //! \brief The current heap size
+    uint32_t m_currHeapSize = 0;
+    //! \brief The size by which a heap is expected to be extended by when the behavior
+    //!        is extend.
+    uint32_t m_extendHeapSize = 0;
+    //! \brief Stores the IDs for the heaps stored in the memory block manager
+    std::list<uint32_t> m_heapIds;
+    //! \brief OS interface used for managing graphics resources
+    PMOS_INTERFACE m_osInterface = nullptr;
+    //!< Indictaes that heap is used by hardware write only.
+    bool m_hwWriteOnlyHeap = false;
+};
+
+#endif // __HEAP_MANAGER_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/media_srcs.cmake	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,39 @@
+# Copyright (c) 2022, Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+set(TMP_HEADERS_
+    ${CMAKE_CURRENT_LIST_DIR}/heap.h
+    ${CMAKE_CURRENT_LIST_DIR}/heap_manager.h
+    ${CMAKE_CURRENT_LIST_DIR}/memory_block.h
+    ${CMAKE_CURRENT_LIST_DIR}/memory_block_manager.h
+    ${CMAKE_CURRENT_LIST_DIR}/frame_tracker.h
+)
+
+set(SOFTLET_COMMON_HEADERS_
+    ${SOFTLET_COMMON_HEADERS_}
+    ${TMP_HEADERS_}
+)
+
+source_group( "Common Files" FILES ${TMP_HEADERS_} )
+
+set(SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_
+    ${SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/memory_block.h 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/memory_block.h
--- 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/memory_block.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/memory_block.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,559 @@
+/*
+* Copyright (c) 2017, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     memory_block.h
+//! \brief    A memory block is a chunk of memory in a heap.
+//! \details  All heap memory is described with memory blocks. Each block has a state
+//!           which determines how it may be used and what other states it may be
+//!           transferred to. The client has limited direct access to a memory block--
+//!           data may be added to the memory location referred to nothing else may be
+//!           modified.
+//!
+
+#ifndef __MEMORY_BLOCK_H__
+#define __MEMORY_BLOCK_H__
+
+#include <memory>
+#include <string>
+#include "heap.h"
+#include "frame_tracker.h"
+
+//! \brief   Describes a block of memory in a heap.
+//! \details For internal use by the MemoryBlockManager only.
+class MemoryBlockInternal
+{
+    friend class MemoryBlockManager;
+
+public:
+    MemoryBlockInternal() { HEAP_FUNCTION_ENTER_VERBOSE; }
+
+    virtual ~MemoryBlockInternal() { HEAP_FUNCTION_ENTER; }
+
+    //!
+    //! \brief  Add data to the memory block.
+    //! \param  [in] data
+    //!         Pointer containint data to insert, must be valid
+    //! \param  [in] dataOffset
+    //!         Relative offset where the data should be inserted within the
+    //!         memory block.
+    //! \param  [in] dataSize
+    //!         Size of the data to be copied from \a data.
+    //! \param  [in] zeroBlock
+    //!         Zeros the entire block, other parameters are not considered
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!       
+    MOS_STATUS AddData(
+        void* data,
+        uint32_t dataOffset,
+        uint32_t dataSize,
+        bool zeroBlock = false);
+
+    //!
+    //! \brief  Read data from the memory block.
+    //! \param  [out] data
+    //!         Pointer to data returned from memory block, must be valid
+    //! \param  [in] dataOffset
+    //!         Relative offset where the data will be read from within the
+    //!         memory block.
+    //! \param  [in] dataSize
+    //!         Size of the data to be copied to \a data.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!       
+    MOS_STATUS ReadData(
+        void* data,
+        uint32_t dataOffset,
+        uint32_t dataSize);
+
+    //!  
+    //! \brief  Dumps the contents of this memory block
+    //! \param  [in] filename
+    //!         The file to be written, includes path
+    //! \param  [in] offset
+    //!         Additional offset to be added to this memory block's offest
+    //! \param  [in] size
+    //!         Size of the data to be dumped, cannot be greater than this memory block's size
+    //! \param  [in] dumpInBinary
+    //!         Dump the data as binary instead of 32-bit hex segments
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!  
+    MOS_STATUS Dump(
+        std::string filename,
+        uint32_t offset = 0,
+        uint32_t size = 0,
+        bool dumpInBinary = false);
+
+    //!
+    //! \brief  Gets the relative offset of the memory block
+    //! \return The relative offset of this block in the heap \see m_offset
+    //!
+    uint32_t GetOffset() { return m_offset; }
+
+    //!
+    //! \brief  Gets the size of the memory block
+    //! \return The size of this block \see m_size
+    //!
+    uint32_t GetSize() { return m_size; }
+
+    //!
+    //! \brief  Gets the tracker ID
+    //! \return This block's tracker ID \see m_trackerId
+    //!
+    uint32_t GetTrackerId() { return m_trackerId; }
+
+    //!
+    //! \brief  Gets the tracker Producer
+    //! \return This block's tracker producer \see m_trackerProducer
+    //!
+    FrameTrackerToken *GetTrackerToken() { return &m_trackerToken; }
+
+    //!
+    //! \brief  Indicates whether or not the memory block is static
+    //! \return If this block is static \see m_static
+    //!
+    bool IsStatic() { return m_static; }
+
+    //! \brief Invalid value to be read from the tracker data \see MemoryBlockInternalManager::m_pTrackerData
+    static const uint32_t m_invalidTrackerId = 0;
+
+protected:
+    //! \brief Possible states of a memory block
+    //! \dot
+    //! digraph states {
+    //!     pool -> free [style = dotted];
+    //!     free -> pool [style = dotted];
+    //!     free -> allocated;
+    //!     free -> deleted;
+    //!     allocated -> submitted;
+    //!     allocated -> deleted;
+    //!     allocated -> allocated [label = "static" labeltooltip = "Static blocks are always in allocated state"];
+    //!     submitted -> allocated [label = "!static" labeltooltip = "This state change requires a refresh."];
+    //!     submitted -> free [label = "!static" labeltooltip = "This state change requires a refresh."];
+    //!     submitted -> deleted;
+    //!     deleted -> pool [style = dotted];
+    //! }
+    //! \enddot
+    enum State
+    {
+        pool = 0,   //!< Memory block is blank and ready to be used by the memory block manager
+        free,       //!< Memory block is available for use by the client
+        allocated,  //!< Space has been acquired in the heap by the client and data may be added to the memory block
+        submitted,  //!< Memory block is submitted, no further changes are permitted
+        deleted,    //!< Memory block is in the process of being freed, may not be used
+        stateCount  //!< Number of states possible for a memory block
+    };
+
+    //!
+    //! \brief  Sets up a memory block in the specified heap
+    //! \param  [in] heap
+    //!         Heap to which this memory block blongs.
+    //! \param  [in] requestedState
+    //!         Requested state for the block.
+    //! \param  [in] prev
+    //!         Memory block which is adjacent to this new block with a lower offset.
+    //! \param  [in] offset
+    //!         Relative offset within \a heap where this memory block is located
+    //! \param  [in] size
+    //!         Size of the memory block.
+    //! \param  [in] trackerId
+    //!         TrackerId associated with this memory block
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS Create(
+        Heap *heap,
+        State requestedState,
+        MemoryBlockInternal *prev,
+        uint32_t offset,
+        uint32_t size,
+        uint32_t trackerId);
+
+    //!
+    //! \brief   Adjusts this block's information such that it may be combined with \a block.
+    //! \details After combining, \a block will be returned to a pool state and this block
+    //!          will have expanded forward or backward to encompass \a block.
+    //! \param   [in] block
+    //!          Must be adjacent to this block to be combined.
+    //! \return  MOS_STATUS
+    //!          MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS Combine(MemoryBlockInternal *block);
+
+    //!
+    //! \brief  Downsizes this block to \a size, puts the remainder into a new block \a block.
+    //! \param  [in,out] block
+    //!         Must be in a pool state. Block which takes some of this blocks space.
+    //! \param  [in] size
+    //!         Size of the new block.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS Split(MemoryBlockInternal *block, uint32_t size);
+
+    //!
+    //! \brief  Indicates that the block is a placeholder until its state changes
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS Pool();
+
+    //!
+    //! \brief  Indicates that the block is ready for re-use
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS Free();
+
+    //!
+    //! \brief  Indicates that the block may be edited
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS Allocate(uint32_t trackerId);
+
+    //!
+    //! \brief  Indicates that the block may be edited
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS Allocate(uint32_t index, uint32_t trackerId, FrameTrackerProducer *producer = nullptr);
+
+    //!
+    //! \brief  Indicates that the client is done editing the memory block.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS Submit();
+
+    //!
+    //! \brief  Indicates that the heap is in the process of being freed.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS Delete();
+
+    //!
+    //! \brief  Indicates the state of the memory block
+    //! \return This block's state \see m_state
+    //!
+    State GetState() { return m_state; }
+
+    //!
+    //! \brief  Forces \see m_static to false
+    //!
+    void ClearStatic() { m_static = false; }
+
+    //!
+    //! \brief  Forces \see m_static to true
+    //!
+    void SetStatic() { m_static = true; }
+
+    //!
+    //! \brief  Gets the previous memory block
+    //! \return The previous adjacent block \see m_prev
+    //!
+    MemoryBlockInternal *GetPrev() { return m_prev; }
+
+    //!
+    //! \brief  Gets the next memory block
+    //! \return The next adjacent block \see m_next
+    //!
+    MemoryBlockInternal *GetNext() { return m_next; }
+
+    //!
+    //! \brief  Gets the heap of the memory block
+    //! \return The heap that this block belongs to \see m_heap
+    //!
+    Heap *GetHeap()
+    {
+        if (m_heap != nullptr)
+        {
+            if (!m_heap->IsValid())
+            {
+                HEAP_ASSERTMESSAGE("Memory block does not have a valid heap to return");
+                return nullptr;
+            }
+        }
+        return m_heap;
+    }
+
+private:
+    //! \brief The heap referred to by the memory block
+    Heap *m_heap = nullptr;
+    //! \brief The relative offset of the memory block within the heap.
+    uint32_t m_offset = 0;
+    //! \brief Size of the memory block.
+    uint32_t m_size = 0;
+    //! \brief State of this memory block
+    State m_state = State::pool;
+    //! \brief   Static memory blocks are controlled by the client and may not be auto-freed
+    //! \details Since the client controls static blocks, static blocks are allowed to have
+    //!          invalid tracker IDs.
+    bool m_static = false;
+    //! \brief Software tag used to determine whether or not a memory block is still in use.
+    uint32_t m_trackerId = m_invalidTrackerId;
+    //! \brief Multiple software tags used to determine whether or not a memory block is still in use.
+    FrameTrackerToken m_trackerToken;
+
+    //! \brief   The previous block in memory, this block is adjacent in heap memory.
+    //! \details Due to the way that the memory manager handles heap memory block lists--by having
+    //!          a dummy block at the start of a heaps block list, this pointer is always expected to
+    //!          be valid for non-pool state blocks.
+    MemoryBlockInternal *m_prev = nullptr;
+    //! \brief   The next block in memory, this block is adjacent in heap memory.
+    //! \details If this block is at the end of the heap, the next block is expected to be nullptr.
+    MemoryBlockInternal *m_next = nullptr;
+
+    //! \brief Previous sorted block, nullptr if this block is the first in the sorted list
+    MemoryBlockInternal *m_statePrev = nullptr;
+    //! \brief Next block in sorted list, nullptr if this block is last in the sorted list
+    MemoryBlockInternal *m_stateNext = nullptr;
+    //! \brief State type for the sorted list to which this block belongs, if between lists type is stateCount
+    State m_stateListType = State::stateCount;
+};
+
+//! \brief Describes a block of memory in a heap.
+class MemoryBlock
+{
+    friend class MemoryBlockManager;
+
+public:
+    MemoryBlock()
+    {
+        HEAP_FUNCTION_ENTER_VERBOSE;
+        m_resource = nullptr;
+    }
+
+    virtual ~MemoryBlock() { HEAP_FUNCTION_ENTER_VERBOSE; }
+
+    //!
+    //! \brief  Add data to the memory block.
+    //! \param  [in] data
+    //!         Pointer containint data to insert, must be valid
+    //! \param  [in] dataOffset
+    //!         Relative offset where the data should be inserted within the
+    //!         memory block.
+    //! \param  [in] dataSize
+    //!         Size of the data to be copied from \a data.
+    //! \param  [in] zeroBlock
+    //!         Zeros the entire block, other parameters are not considered
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!       
+    MOS_STATUS AddData(
+        void* data,
+        uint32_t dataOffset,
+        uint32_t dataSize,
+        bool zeroBlock = false)
+    {
+        if (!m_valid || m_block == nullptr)
+        {
+            HEAP_ASSERTMESSAGE("The memory block is not valid!");
+            return MOS_STATUS_INVALID_PARAMETER;
+        }
+        return m_block->AddData(data, dataOffset, dataSize, zeroBlock);
+    }
+
+    //!
+    //! \brief  Read data from the memory block.
+    //! \param  [out] data
+    //!         Pointer to data returned from memory block, must be valid
+    //! \param  [in] dataOffset
+    //!         Relative offset where the data will be read from within the
+    //!         memory block.
+    //! \param  [in] dataSize
+    //!         Size of the data to be copied to \a data.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!       
+    MOS_STATUS ReadData(
+        void* data,
+        uint32_t dataOffset,
+        uint32_t dataSize)
+    {
+        if (!m_valid || m_block == nullptr)
+        {
+            HEAP_ASSERTMESSAGE("The memory block is not valid!");
+            return MOS_STATUS_INVALID_PARAMETER;
+        }
+
+        return m_block->ReadData(data, dataOffset, dataSize);
+    }
+
+    //!  
+    //! \brief  Dumps the contents of this memory block
+    //! \param  [in] filename
+    //!         The file to be written, includes path
+    //! \param  [in] offset
+    //!         Additional offset to be added to this memory block's offest
+    //! \param  [in] size
+    //!         Size of the data to be dumped, cannot be greater than this memory block's size
+    //! \param  [in] dumpInBinary
+    //!         Dump the data as binary instead of 32-bit hex segments
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!  
+    MOS_STATUS Dump(
+        std::string filename,
+        uint32_t offset = 0,
+        uint32_t size = 0,
+        bool dumpInBinary = false)
+    {
+        if (!m_valid || m_block == nullptr)
+        {
+            HEAP_ASSERTMESSAGE("The memory block is not valid!");
+            return MOS_STATUS_INVALID_PARAMETER;
+        }
+        return m_block->Dump(filename, offset, size, dumpInBinary);
+    }
+
+    //!
+    //! \brief  Indicates whether or not the memory block is static
+    //! \return If this block is static \see m_static
+    //!
+    bool IsValid() { return m_valid; }
+
+    //!
+    //! \brief  Gets the relative offset of the memory block
+    //! \return The relative offset of this block in the heap \see m_offset
+    //!
+    uint32_t GetOffset() { return m_offset; }
+
+    //!
+    //! \brief  Gets the size of the memory block
+    //! \return The size of this block \see m_size
+    //!
+    uint32_t GetSize() { return m_size; }
+
+    //!
+    //! \brief  Gets the tracker ID
+    //! \return This block's tracker ID \see m_trackerId
+    //!
+    uint32_t GetTrackerId() { return m_trackerId; }
+
+    //!
+    //! \brief  Indicates whether or not the memory block is static
+    //! \return If this block is static \see m_static
+    //!
+    bool IsStatic() { return m_static; }
+
+    //!
+    //! \brief  Gets the heap of the memory block
+    //! \return The heap that this block belongs to \see m_heap
+    //!
+    MOS_RESOURCE* GetResource()
+    {
+        HEAP_FUNCTION_ENTER_VERBOSE;
+        if (!m_valid)
+        {
+            HEAP_ASSERTMESSAGE("The memory block is not valid!");
+            return nullptr;
+        }
+        if (Mos_ResourceIsNull(m_resource))
+        {
+            HEAP_ASSERTMESSAGE("The heap resource is invalid");
+            return nullptr;
+        }
+        return m_resource;
+    }
+
+    //!
+    //! \brief  Gets the size of the heap to which the memory block belongs
+    //! \return The size of the associated heap \see m_heapSize
+    //!
+    uint32_t GetHeapSize() { return m_heapSize; }
+
+#if (_DEBUG || _RELEASE_INTERNAL)
+    //!
+    //! \brief   Gets the locked heap
+    //! \details To be used when the memory block dump is insufficient.
+    //! \return  Pointer to the locked heap data \see m_lockedHeap
+    //!
+    uint8_t* GetHeapLockedData() { return m_lockedHeap; }
+#endif
+
+    //! \brief Invalid value to be read from the tracker data \see MemoryBlockInternalManager::m_pTrackerData
+    static const uint32_t m_invalidTrackerId = MemoryBlockInternal::m_invalidTrackerId;
+
+protected:
+    //!
+    //! \brief  Initializes memory block based on provided inputs
+    //! \param  [in] internalBlock
+    //!         Internal block used to initialize this memory block
+    //! \param  [in] heap
+    //!         Heap used to initialize this memory block
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS CreateFromInternalBlock(
+        MemoryBlockInternal *internalBlock,
+        Heap *heap,
+        uint8_t *lockedHeap)
+    {
+        HEAP_CHK_NULL(internalBlock);
+        HEAP_CHK_NULL(heap);
+        if (!heap->IsValid())
+        {
+            HEAP_ASSERTMESSAGE("Memory block does not have a valid heap to return");
+            return MOS_STATUS_INVALID_PARAMETER;
+        }
+        HEAP_CHK_NULL(m_resource = heap->GetResource());
+        m_heapSize = heap->GetSize();
+#if (_DEBUG || _RELEASE_INTERNAL)
+        m_lockedHeap = lockedHeap;
+#endif
+        m_offset = internalBlock->GetOffset();
+        m_size = internalBlock->GetSize();
+        m_static = internalBlock->IsStatic();
+        m_trackerId = internalBlock->GetTrackerId();
+        m_block = internalBlock;
+        m_valid = true;
+        return MOS_STATUS_SUCCESS;
+    }
+
+    //!
+    //! \brief  Gets the internal memory block
+    //! \return The internal memory block backing up this data
+    //!
+    MemoryBlockInternal *GetInternalBlock() { return m_block; }
+
+private:
+    bool m_valid = false;       //!< Memory block is valid.
+    MOS_RESOURCE *m_resource;    //!< Graphics resource for the heap
+#if (_DEBUG || _RELEASE_INTERNAL)
+    uint8_t *m_lockedHeap = nullptr;    //!< Pointer to the locked heap data, only valid if kept locked
+#endif
+    uint32_t m_heapSize = 0;    //!< Size of the heap
+    uint32_t m_offset = 0;      //!< relative offset of the memory block within the heap.
+    uint32_t m_size = 0;        //!< Size of the memory block.
+    //! \brief   Static memory blocks are controlled by the client and may not be auto-freed
+    //! \details Since the client controls static blocks, static blocks are allowed to have
+    //!          invalid tracker IDs.
+    bool m_static = false;
+    //! \brief Software tag used to determine whether or not a memory block is still in use.
+    uint32_t m_trackerId = m_invalidTrackerId;
+    MemoryBlockInternal *m_block = nullptr; //!< Reference to the internal memory block
+};
+
+#endif // __MEMORY_BLOCK_H__
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/memory_block_manager.h 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/memory_block_manager.h
--- 22.4.3+ds1-1/media_common/agnostic/common/heap_manager/memory_block_manager.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/heap_manager/memory_block_manager.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,449 @@
+/*
+* Copyright (c) 2017, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     memory_block_manager.h
+//! \brief    Manages the memory blocks belonging to all heaps.
+//! \details  Ensures that all memory is accounted for per heap for each block.
+//!           Determines when blocks are no longer being processed and automatically
+//!           reclaims free space in the state heap. Manages the state transitions of
+//!           the memory blocks. The client has not direct access to the memory block
+//!           manager.
+//!
+
+#ifndef __MEMORY_BLOCK_MANAGER_H__
+#define __MEMORY_BLOCK_MANAGER_H__
+
+#include <list>
+#include <vector>
+#include <memory>
+#include "heap.h"
+#include "memory_block.h"
+
+class FrameTrackerProducer;
+
+//! \brief Used by the heap manager to allow the client to access the heap memory.
+class MemoryBlockManager
+{
+    friend class HeapManager;
+
+public:
+    //! \brief Used by the client to acquire space in heap memory.
+    class AcquireParams
+    {
+    public:
+        //! \brief initializes AcquireParams with a tracker ID
+        AcquireParams(
+            uint32_t trackerId,
+            std::vector<uint32_t> &blockSizes) : m_blockSizes(blockSizes)
+        {
+            m_trackerId = trackerId;
+        }
+        virtual ~AcquireParams() {}
+
+        //! \brief Block sizes to allocate
+        std::vector<uint32_t>   &m_blockSizes;
+        //! \brief Requested block alignment
+        uint32_t                m_alignment = 0;
+        //! \brief Index to the frame tracker
+        uint32_t                m_trackerIndex = 0;
+        //! \brief Must be valid, used for determining whether or not a the block is still in use. \see m_trackerData.
+        uint32_t                m_trackerId = MemoryBlockInternal::m_invalidTrackerId;
+        //! \brief Zero memory blocks after allocation
+        bool                    m_zeroAssignedBlock = false;
+        //! \brief Block allocations are flaged as static are expected to be controlled by the client. \see HeapManager::Behavior::clientControlled.
+        bool                    m_staticBlock = false;
+    };
+
+    MemoryBlockManager() { HEAP_FUNCTION_ENTER; }
+    virtual ~MemoryBlockManager();
+
+protected:
+    //!
+    //! \brief  Acquires space within the heap(s)
+    //! \param  [in] params
+    //!         Parameters describing the requested space
+    //! \param  [out] blocks
+    //!         A vector containing the memory blocks allocated
+    //! \param  [out] spaceNeeded
+    //!         Amount of space that the heap(s) are short of to complete space acquisition
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS AcquireSpace(
+        AcquireParams &params,
+        std::vector<MemoryBlock> &blocks,
+        uint32_t &spaceNeeded);
+
+    //!
+    //! \brief  Indicates that the client is done editing the blocks
+    //! \param  [in] blocks
+    //!         Blocks to be submitted
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS SubmitBlocks(std::vector<MemoryBlock> &blocks);
+
+    //!
+    //! \brief   Either directly adds a block to the free list, or prepares it to be added
+    //! \param   [in] block
+    //!          Block to be removed
+    //! \return  MOS_STATUS
+    //!          MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS ClearSpace(MemoryBlock &block);
+
+    //! \brief   Reclaims free memory based on whether or not blocks are no longer in use \see m_trackerData
+    //! \param   [out] blocksUpdated
+    //!          If true blocks have been updated, if false, no blocks were updated
+    //! \return  MOS_STATUS
+    //!          MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS RefreshBlockStates(bool &blocksUpdated);
+
+    //!
+    //! \brief  Stores heap and initializes memory blocks for future use.
+    //! \param  [in] heapId
+    //!         ID for the heap to be created
+    //! \param  [in] size
+    //!         Size of the heap to be created.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS RegisterHeap(uint32_t heapId, uint32_t size, bool hwWriteOnly = false);
+
+    //!
+    //! \brief  Removes the specified heap from the block manager, this occurs when the
+    //!         heap is in the process of being deleted. Ensures heap is not in use.
+    //! \param  [in] heapId
+    //!         ID for heap to be removed.
+    //!
+    MOS_STATUS UnregisterHeap(uint32_t heapId);
+
+    //!
+    //! \brief  Completes heap deletion for all heaps with unused space in the deleted heaps list.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS CompleteHeapDeletion();
+
+    //!
+    //! \brief  Registers the tracker data to be used for determining whether a
+    //!         memory block is available.
+    //! \param  [in] trackerData
+    //!         Must be valid. See description in \see MemoryBlockManager::m_trackerData.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS RegisterTrackerResource(uint32_t *trackerData);
+
+    //!
+    //! \brief  Registers the tracker producer to be used for determining whether a
+    //!         memory block is available. This function has a higher priority than
+    //!         RegisterTrackerResource, so if it is called, the trackerResource will
+    //!         be useless.
+    //! \param  [in] trackerProducer
+    //!         Must be valid; pointer to trackerProducer.
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS RegisterTrackerProducer(FrameTrackerProducer *trackerProducer);
+
+    //!
+    //! \brief  Gets the size of the all heaps
+    //! \return The size of all heaps managed \see m_size
+    //!
+    uint32_t GetSize() { return m_totalSizeOfHeaps; }
+
+    //!
+    //! \brief  Determines whether a valid tracker data has been registered
+    //! \return True if the pointer is valid, false otherwise
+    //!
+    bool IsTrackerDataValid()
+    {
+        return (!m_useProducer && m_trackerData != nullptr)
+            || (m_useProducer && m_trackerProducer != nullptr);
+    }
+
+    //!
+    //! \brief   All heaps allocated are locked and kept locked for their lifetimes
+    //! \details May only be set before any heaps are allocated.
+    //! \return  MOS_STATUS
+    //!          MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS LockHeapsOnAllocate()
+    {
+        HEAP_FUNCTION_ENTER;
+        if (m_totalSizeOfHeaps != 0)
+        {
+            HEAP_ASSERTMESSAGE("Locking heaps on allocate may only be set before heaps are allocated");
+            return MOS_STATUS_UNKNOWN;
+        }
+        m_lockHeapsOnAllocate = true;
+        return MOS_STATUS_SUCCESS;
+    }
+
+private:
+    //! \brief Describes the information managed by this class for each heap registered
+    struct HeapWithAdjacencyBlockList
+    {
+        HeapWithAdjacencyBlockList()
+        {
+            HEAP_FUNCTION_ENTER;
+        }
+
+        virtual ~HeapWithAdjacencyBlockList()
+        {
+            HEAP_FUNCTION_ENTER;
+            MOS_Delete(m_heap);
+            auto curr = m_adjacencyListBegin;
+            MemoryBlockInternal *next = nullptr;
+
+            while (curr != nullptr)
+            {
+                next = curr->GetNext();
+                MOS_Delete(curr);
+                curr = next;
+            }
+        }
+
+        //! \brief Heap which all other members of this struct define.
+        Heap *m_heap = nullptr;
+        //! \brief The list of blocks in the heap arranged by offset in the heap. The head is a dummy block.
+        MemoryBlockInternal *m_adjacencyListBegin = nullptr;
+        //! \brief The size of the heap
+        uint32_t m_size = 0;
+    };
+
+    //!
+    //! \brief  Stores the provided OS interface in the heap
+    //! \param  [in] osInterface
+    //!         Must be valid
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!  
+    MOS_STATUS RegisterOsInterface(PMOS_INTERFACE osInterface);
+
+    //!
+    //! \brief  Determines whether or not space is available, if not enough space returns
+    //!         the amount short in \a spaceNeeded
+    //! \param  [in] sortedSizes
+    //!         Requested block sizes sorted in decending order.
+    //! \param  [in] params
+    //!         Parameters describing the requested space
+    //! \param  [out] spaceNeeded
+    //!         Amount of space that the heap(s) are short of to complete space acquisition
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS IsSpaceAvailable(
+        AcquireParams &params,
+        uint32_t &spaceNeeded);
+
+    //!
+    //! \brief  Sets up memory blocks for the requested space
+    //! \param  [in] sortedSizes
+    //!         Requested block sizes sorted in decending order with original index saved from params.
+    //! \param  [in] params
+    //!         Parameters describing the requested space
+    //! \param  [out] blocks
+    //!         A vector containing the memory blocks allocated
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS AllocateSpace(
+        AcquireParams &params,
+        std::vector<MemoryBlock> &blocks);
+
+    //!
+    //! \brief  Sets up memory blocks for the requested space
+    //! \param  [in] alignedSize
+    //!         Aligned size of the memory requested
+    //! \param  [in] trackerId
+    //!         Tracker ID to be used for the allocated block
+    //! \param  [in] staticBlock
+    //!         Indicates that the newly created block is expected to be static
+    //! \param  [out] freeBlock
+    //!         Free block that will be used for the allocation of the new block
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS AllocateBlock(
+        uint32_t alignedSize,
+        uint32_t trackerId,
+        bool staticBlock,
+        MemoryBlockInternal *freeBlock);
+
+    //!
+    //! \brief  Sets up memory blocks for the requested space
+    //! \param  [in] alignedSize
+    //!         Aligned size of the memory requested
+    //! \param  [in] trackerIndex
+    //!         Tracker index to be used for the allocated block
+    //! \param  [in] trackerId
+    //!         Tracker ID to be used for the allocated block
+    //! \param  [in] staticBlock
+    //!         Indicates that the newly created block is expected to be static
+    //! \param  [out] freeBlock
+    //!         Free block that will be used for the allocation of the new block
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS AllocateBlock(
+        uint32_t alignedSize,
+        uint32_t trackerIndex,
+        uint32_t trackerId,
+        bool staticBlock,
+        MemoryBlockInternal *freeBlock);
+
+    //!
+    //! \brief  Sets up memory blocks for the requested space
+    //! \param  [in] block
+    //!         Block to be added to the sorted pool of type \a state
+    //! \param  [in] state
+    //!         Type of pool to be added to
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS AddBlockToSortedList(
+        MemoryBlockInternal *block,
+        MemoryBlockInternal::State state);
+
+    //!
+    //! \brief  Sets up memory blocks for the requested space
+    //! \param  [in] block
+    //!         Block to be added to the sorted pool of type \a state
+    //! \param  [in] state
+    //!         Type of pool to be added to, may not be of type MemoryBlockInternal::State::pool since a separate function is dedicated to that case. \see GetBlockFromPool
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS RemoveBlockFromSortedList(
+        MemoryBlockInternal *block,
+        MemoryBlockInternal::State state);
+
+    //!
+    //! \brief  Gets a pool type block from the sorted block pool, if pool is empty allocates a new one
+    //!         \see m_sortedBlockList[MemoryBlockInternal::State::pool]
+    //! \return MemoryBlockInternal*
+    //!         Valid pointer if success, nullptr if fail
+    //!
+    MemoryBlockInternal* GetBlockFromPool();
+
+    //!
+    //! \brief  Removes all blocks with heaps matching \a heapId from the sorted block pool for \a state. \see m_sortedBlockList
+    //! \param  [in] heapId
+    //!         Heap whose blocks should be removed
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS RemoveHeapFromSortedBlockList(
+        uint32_t heapId);
+
+    //!
+    //! \brief  Merges two contiguous blocks into one.
+    //! \param  [in,out] blockCombined
+    //!         Block into which \a blockRelease will be merged in to, this block is the output of the merge
+    //! \param  [in] blockRelease
+    //!         Block to be merged into \a blockCombined, this block will be added back to the pool after the merge
+    //! \return MOS_STATUS
+    //!         MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS MergeBlocks(
+        MemoryBlockInternal *blockCombined,
+        MemoryBlockInternal *blockRelease);
+
+    //!
+    //! \brief  Temporary function while MOS utilities function is added for smart pointers
+    //! \return std::shared_ptr<T>
+    //!         Valid pointer if success, nullptr if fail
+    //!
+    template <class T, class... Args>
+    std::shared_ptr<T> MakeShared(Args&&... args)
+    {
+        std::shared_ptr<T> block = nullptr;
+        try
+        {
+            block = std::make_shared<T>(args...);
+        }
+        catch (const std::bad_alloc& e)
+        {
+            HEAP_ASSERTMESSAGE("Allocation of memory block failed!");
+            return nullptr;
+        }
+        return block;
+    }
+
+
+    //! \brief  Used to retain information about the requested block sizes after those
+    //!         sizes are sorted for the return of blocks.\see AcquireParams::m_blockSizes \see AcquireSpace
+    struct SortedSizePair
+    {
+        //! \brief Constructs SortedSizePair
+        SortedSizePair() {}
+        SortedSizePair(uint32_t originalIdx, uint32_t blockSize)
+            : m_originalIdx(originalIdx), m_blockSize(blockSize) {}
+        uint32_t m_originalIdx = 0; //!< Original index of the requested block size \see AcquireParams::m_blockSizes
+        uint32_t m_blockSize = 0;   //!< Aligned block size
+    };
+
+    //! \brief Alignment for blocks in heap, currently fixed at a cacheline
+    static const uint16_t m_blockAlignment = 64;
+    //! \brief Alignment for heap, currently fixed at a page
+    static const uint16_t m_heapAlignment = MOS_PAGE_SIZE;
+    //! \brief Number of submissions before a refresh, currently fixed
+    static const uint16_t m_numSubmissionsForRefresh = 128;
+
+    //! \brief Total size of all managed heaps.
+    uint32_t m_totalSizeOfHeaps = 0;
+    //! \brief The list of block pools per heap
+    std::list<std::shared_ptr<HeapWithAdjacencyBlockList>> m_heaps;
+    //! \brief List of block pools per heap for heaps in deletion process
+    std::list<std::shared_ptr<HeapWithAdjacencyBlockList>> m_deletedHeaps;
+    //! \brief Pools of memory blocks sorted by their states based on the state indicated
+    //!        by the latest TrackerId. The free pool is sorted in ascending order.
+    MemoryBlockInternal *m_sortedBlockList[MemoryBlockInternal::State::stateCount] = {nullptr};
+    //! \brief Number of entries in each sorted block list.
+    uint32_t m_sortedBlockListNumEntries[MemoryBlockInternal::State::stateCount] = {0};
+    //! \brief Sizes of each block pool.
+    //! \brief MemoryBlockInternal::State::pool type blocks have no size, and thus that pool also is expected to be size 0.
+    uint32_t m_sortedBlockListSizes[MemoryBlockInternal::State::stateCount] = {0};
+    //! \brief   Used to compare to a memory block's tracker ID. If the value is greater
+    //!          than the tracker ID, then the block is no longer in use and may be reclaimed
+    //!          as free space, or if the block is static transitioned to allocated state so
+    //!          it may be re-used. \see MemoryBlockInternal::m_trackerId
+    //! \details The client is expected to manage this tracker; it should be valid for the
+    //!          life of the heap manager. The tracker may be updated at whatever granularity is
+    //!          appropriate--per workload, per frame, etc. It is expected that when the
+    //!          tracker data indicates that all blocks with tracker IDs less than or equal
+    //!          to the udpated value may be re-used.
+    uint32_t *m_trackerData = nullptr;
+    PMOS_INTERFACE m_osInterface = nullptr; //!< OS interface used for managing graphics resources
+    bool m_lockHeapsOnAllocate = false;             //!< All heaps allocated with the keep locked flag.
+    
+    //! \brief Persistent storage for the sorted sizes used during AcquireSpace()
+    std::list<SortedSizePair> m_sortedSizes;
+    //! \brief TrackerProducer
+    FrameTrackerProducer *m_trackerProducer = nullptr;
+    //! \bried Whether trackerProducer is set
+    bool m_useProducer = false;
+};
+#endif // __MEMORY_BLOCK_MANAGER_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/hw/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2021, Intel Corporation
+# Copyright (c) 2021-2022, Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -24,19 +24,23 @@ set(TMP_HEADERS_
     ${CMAKE_CURRENT_LIST_DIR}/mhw_mi.h
     ${CMAKE_CURRENT_LIST_DIR}/mhw_mmio.h
     ${CMAKE_CURRENT_LIST_DIR}/mhw_render.h
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_blt.h
     ${CMAKE_CURRENT_LIST_DIR}/mhw_utilities.h
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_state_heap.h
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_block_manager.h
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_memory_pool.h
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_sfc.h
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_vebox.h
 )
 
-set(HEADERS_
-    ${HEADERS_}
-    ${TMP_HEADERS_}
-)
-
-set(COMMON_HEADERS_
-    ${COMMON_HEADERS_}
+set(SOFTLET_COMMON_HEADERS_
+    ${SOFTLET_COMMON_HEADERS_}
     ${TMP_HEADERS_}
 )
 
 source_group("MHW" FILES ${TMP_HEADERS_})
 
-media_add_curr_to_include_path()
+set(SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_
+    ${SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_block_manager.h 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_block_manager.h
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_block_manager.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_block_manager.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,512 @@
+/*
+* Copyright (c) 2015-2017, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file      mhw_block_manager.h 
+//! \brief         This modules implements state heap block manager used in MHW 
+//!
+#ifndef __MHW_BLOCK_MANAGER_H__
+#define __MHW_BLOCK_MANAGER_H__
+
+#include "mos_os.h"
+#include "mhw_state_heap.h"
+#include "mhw_memory_pool.h"
+
+#define BLOCK_MANAGER_CHK_STATUS(_stmt)                                               \
+    MOS_CHK_STATUS_RETURN(MOS_COMPONENT_HW, MOS_HW_SUBCOMP_ALL, _stmt)
+
+#define BLOCK_MANAGER_CHK_STATUS_MESSAGE(_stmt, _message, ...)                        \
+    MOS_CHK_STATUS_MESSAGE_RETURN(MOS_COMPONENT_HW, MOS_HW_SUBCOMP_ALL, _stmt, _message, ##__VA_ARGS__)
+
+#define BLOCK_MANAGER_CHK_NULL(_ptr)                                                  \
+    MOS_CHK_NULL_RETURN(MOS_COMPONENT_HW, MOS_HW_SUBCOMP_ALL, _ptr)
+
+#define MHW_BLOCK_MANAGER_INVALID_TAG ((uint32_t)-1)
+
+// Maximum allocation array size
+#define MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY  64
+
+typedef struct _MHW_BLOCK_MANAGER_PARAMS
+{
+    uint32_t                     dwPoolInitialCount;     //!< Initial number of memory blocks in pool
+    uint32_t                     dwPoolMaxCount;         //!< Maximum number of memory blocks in pool
+    uint32_t                     dwPoolIncrement;        //!< Memory block pool increment
+    uint32_t                     dwHeapInitialSize;      //!< Initial heap size
+    uint32_t                     dwHeapIncrement;        //!< Heap size increment
+    uint32_t                     dwHeapMaxSize;          //!< Maximum overall heap size
+    uint32_t                     dwHeapMaxCount;         //!< Maximum number of heaps
+    uint32_t                     dwHeapGranularity;      //!< Block granularity
+    uint32_t                     dwHeapBlockMinSize;     //!< Minimum block fragment size (never create a block smaller than this)
+} MHW_BLOCK_MANAGER_PARAMS, *PMHW_BLOCK_MANAGER_PARAMS;
+
+#define MHW_BLOCK_POSITION_TAIL (NULL)
+#define MHW_BLOCK_POSITION_HEAD ((PMHW_STATE_HEAP_MEMORY_BLOCK) -1)
+
+typedef struct _MHW_BLOCK_LIST
+{
+    PMHW_BLOCK_MANAGER              pBlockManager;      //!< Block Manager the list belongs to
+    PMHW_STATE_HEAP_MEMORY_BLOCK    pHead;              //!< Head of the list
+    PMHW_STATE_HEAP_MEMORY_BLOCK    pTail;              //!< Tail of the list
+    MHW_BLOCK_STATE                 BlockState;         //!< Described the type of block the list contains
+    int32_t                         iCount;             //!< Number of elements on the list
+    uint32_t                        dwSize;             //!< Total memory in the list
+    char                            szListName[16];     //!< List name for debugging purposes
+} MHW_BLOCK_LIST, *PMHW_BLOCK_LIST;
+
+struct MHW_BLOCK_MANAGER
+{
+private:
+    MHW_BLOCK_MANAGER_PARAMS m_Params;                              //!< Block Manager configuration
+    MHW_MEMORY_POOL          m_MemoryPool;                          //!< Memory pool of PMHW_STATE_HEAP_MEMORY_BLOCK objects
+    MHW_BLOCK_LIST           m_BlockList[MHW_BLOCK_STATE_COUNT];    //!< Block lists associated with each block state
+    PMHW_STATE_HEAP          m_pStateHeap;                          //!< Points to state heap
+
+public:
+
+    //!
+    //! \brief    Initializes the MHW_BLOCK_MANAGER
+    //! \details  Constructor of MHW_BLOCK_MANAGER which initializes all parameters and members
+    //! \param    [in] pParams
+    //!           Pointer to block manager params. If it is null, default param will be used.
+    //!
+    MHW_BLOCK_MANAGER(PMHW_BLOCK_MANAGER_PARAMS pParams);
+
+    //!
+    //! \brief    Destructor of MHW_BLOCK_MANAGER
+    ~MHW_BLOCK_MANAGER();
+
+    //!
+    //! \brief    Adds newly created state heap to block manager
+    //! \details  Adds a new state heap to memory block manager. A new memory free memory block is added to
+    //!           the free list representing the new available heap.
+    //! \param    [in] pStateHeap
+    //!           Pointer to the newly created state heap
+    //! \return   MOS_STATUS
+    //!           Returns the status of the operation
+    //!
+    MOS_STATUS RegisterStateHeap(PMHW_STATE_HEAP    pStateHeap);
+
+    //!
+    //! \brief    Unregisters state heap from block manager prior to deallocation
+    //! \details  Removes state heap from block manager. Memory blocks must be all deleted.
+    //! \param    [in] pStateHeap
+    //!           Pointer to the newly created state heap
+    //! \return   MOS_STATUS
+    //!           Returns the status of the operation
+    //!
+    MOS_STATUS UnregisterStateHeap(PMHW_STATE_HEAP    pStateHeap);
+
+    //!
+    //! \brief    Update block states based on last executed tag
+    //! \details  Update block states based on last executed tag
+    //!           submitted unlocked blocks are released;
+    //!           move to allocated
+    //! \param    [in] dwSyncTag
+    //!           sync tag
+    //! \return   MOS_STATUS
+    //!           Returns the status of the operation
+    //!
+    MOS_STATUS Refresh();
+
+    //!
+    //! \brief    Allocate memory block with scratch space
+    //! \details  Allocate memory block with scratch space
+    //! \param    [in] dwSize
+    //!           Size of memory block to allocate 
+    //! \param    [in] dwAlignment
+    //!           Alignment
+    //! \param    [in] dwScratchSpace
+    //!           Scratch space size
+    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
+    //!           Pointer to the allocated memory block
+    //!
+    PMHW_STATE_HEAP_MEMORY_BLOCK AllocateWithScratchSpace(
+        uint32_t            dwSize,
+        uint32_t            dwAlignment,
+        uint32_t            dwScratchSpace);
+
+    //!
+    //! \brief    Allocate free block of memory
+    //! \details  Allocate free memory block of memory for use by the client
+    //! \param    [in] dwSize
+    //!           Size of memory to be allocated
+    //! \param    [in] dwAlignment
+    //!           Memory alignment
+    //! \param    [in] pHeapAffinity
+    //!           Pointer to heap affinity
+    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
+    //!           Pointer to allocated memory block
+    //!
+    PMHW_STATE_HEAP_MEMORY_BLOCK AllocateBlock(
+        uint32_t            dwSize,
+        uint32_t            dwAlignment,
+        PMHW_STATE_HEAP     pHeapAffinity);
+
+    //!
+    //! \brief    Free memory block
+    //! \details  Free memory block according to the sync tag
+    //! \param    [in] pBlock
+    //!           Pointer to memory block to be freed
+    //! \param    [in] dwSyncTag
+    //!           Sync tag
+    //! \return   MOS_STATUS
+    //!           Returns the status of the operation
+    //!
+    MOS_STATUS FreeBlock(
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock);
+
+    //!
+    //! \brief    Calculate the memory of space required
+    //! \details  Calculate the memory of space required
+    //! \param    [in] pdwSizes
+    //!           Pointer to memory block to be freed
+    //! \param    [in] iCount
+    //!           Sync tag
+    //! \param    [in] dwAlignment
+    //!           alignment
+    //! \param    [in] bHeapAffinity 
+    //!           heap affinity
+    //! \param    [in] pHeapAffinity 
+    //!           pointer to state heap affinity
+    //! \return   uint32_t Size of space needed by client
+    //!
+    uint32_t CalculateSpaceNeeded(
+        const uint32_t      *pdwSizes,
+        int32_t             iCount,
+        uint32_t            dwAlignment,
+        bool                bHeapAffinity,
+        PMHW_STATE_HEAP     pHeapAffinity);
+
+    //!
+    //! \brief    Submit memory block
+    //! \details  Submit memory block according to the sync tag
+    //! \param    [in] pBlock
+    //!           Pointer to memory block to be submitted
+    //! \param    [in] dwSyncTag
+    //!           Sync tag
+    //! \return   MOS_STATUS
+    //!           Returns the status of the operation
+    //!
+    MOS_STATUS SubmitBlock(
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
+        const FrameTrackerTokenFlat  *trackerToken);
+
+    //!
+    //! \brief    Set state heap to block manager
+    //! \details  Set state heap to block manager
+    //! \param    [in] pStateHeap
+    //!           Pointer to state heap
+    //!
+    void SetStateHeap(PMHW_STATE_HEAP pStateHeap);
+
+    // Multiple Block Allocation algorithm description (multiple kernel load):
+    //
+    // Multiple blocks must be efficiently allocated in multiple heaps or in a single heap.
+    //
+    // Each load may introduce block fragmentation. The more kernels are loaded, the greater
+    // are the chances to fragment the heap, reducing the chances of finding contiguous for a
+    // larger kernel. Therefore, the efficient way to use the heap is to load larger kernels
+    // first ensuring they have enough contiguous space, and then load the smaller kernels,
+    // which are more likely to fit in remaining blocks.
+    //
+    // So the algorithm is the following:
+    //
+    // 1) The total size of all blocks is calculated to check if there's even a fighting chance
+    //    to load them all - if the amount available is insufficient, other measures will be taken.
+    //
+    // 2) In order to allocate blocks according to size, we first sort the array of sizes
+    //    using an index array (never touching the source array!) - this is done by a merge sort
+    //    implementation, which is O(n*log(n)) - may try using other algorithm such as QuickSort -
+    //    although quicksort is not always the best (may be O(n^2) in same cases)
+    //
+    // 3) Select a specific heap (or nullptr if bHeapAffinity is false). Check if there is enough space
+    //    to load all blocks - ignoring the fragmentation for now. Only by traversing the list of
+    //    blocks we will be able to determine if the heap can be used or not. Trying to load larger
+    //    kernels FIRST helps identifying heap fragmentation issues faster than leaving it for last.
+    //
+    // 4) Load the array of kernels one at a time according to size (larger first). Select a specific
+    //    heap or nullptr (if any heap, don't care).
+    //
+    // 5) If all succeeded, then we are ready to return the list of blocks to the client.
+    //
+    // 6) If it fails, release the already allocated blocks. the algorithm does check for space in the
+    //    current heap before even starting the loop. The failure will not happen for lack of space,
+    //    but because of fragmentation of free space. In case of bHeapAffinity = false, we also check
+    //    the aggregate free space.
+    //
+    // 7) If the heap affinity is selected and the intended heap is also provided, we're done - if we
+    //    were not able to load the blocks, the overall operation has failed. If affinity is selected but
+    //    the heap was not provided, we try the next heap until no more heaps are available. This particular
+    //    situation is intended for loading all blocks in the same heap without specifying which one.
+    //
+
+    //!
+    //! \brief    Allocate multiple blocks 
+    //! \details  Allocate multiple blocks 
+    //! \param    [in]  pdwSizes
+    //!           Pointer to sizes
+    //! \param    [in]  iCount
+    //!           Count of blocks to be allocated
+    //! \param    [in] dwAlignment
+    //!           Alignment
+    //! \param    [in] bHeapAffinity
+    //!           true if all blocks must be allocated in the same heap 
+    //! \param    [in] pHeapAffinity
+    //!           Pointer to heap affinity 
+    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
+    //!           Pointer to allocated memory block
+    //!
+    PMHW_STATE_HEAP_MEMORY_BLOCK AllocateMultiple(
+        uint32_t            *pdwSizes,
+        int32_t             iCount,
+        uint32_t            dwAlignment,
+        bool                bHeapAffinity,
+        PMHW_STATE_HEAP     pHeapAffinity);
+
+private:
+
+    //!
+    //! \brief    Gets memory block from pool
+    //! \details  Gets memory block from pool, extending the pool if necessary
+    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
+    //!           Returns a pointer to the memory block, nullptr if failed to allocate or
+    //!           all blocks are in use and the pool reached its maximum size.
+    //!
+    PMHW_STATE_HEAP_MEMORY_BLOCK GetBlockFromPool();
+
+    //!
+    //! \brief    Extends pool of MHW_STATE_HEAP_MEMORY_BLOCK objects
+    //! \details  Allocates an array of MHW_STATE_HEAP_MEMORY_BLOCK objects and appends to the pool of objects for reuse.
+    //!           The allocation of memory block structures is limited to the maximum number defined when creating
+    //!           the Memory Block Manager object. The increase in number of memory blocks may be due to increased
+    //!           block fragmentation, system load or other factors (increase in queue depth, increas in memory
+    //!           blocks maintained by the client - such as number of kernels loaded).
+    //! \param    [in] dwCount
+    //!           Number of additional blocks to add to the pool
+    //! \return   N/A
+    //!
+    void ExtendPool(uint32_t dwCount);
+
+    //!
+    //! \brief    Attach block into appropriate memory block list
+    //! \details  Sets block state and inserts it into the memory block list associated with the new state.
+    //!           The block may be inserted at the "Head" or "Tail" of the list, or after another block from the same list.
+    //! \param    [in]BlockState
+    //!           New block state, defines which list the block is to be inserted.
+    //!           NOTE: The block must not belong to any other list before calling this function (pPrev/pNext = nullptr).
+    //! \param    [in] pBlock
+    //!           Pointer to memory block
+    //! \param    [in] pBlockPos
+    //!           Pointer to memory block after which the block is to be inserted (inserted AFTER pBlockPos)
+    //!           If set to MHW_BLOCK_POSITION_HEAD, inserts block at the head of the list.
+    //!           If set to MHW_BLOCK_POSITION_TAIL, inserts block at the tail of the list.
+    //! \return   MOS_STATUS
+    //!           Returns error code
+    //!
+    MOS_STATUS AttachBlock(
+        MHW_BLOCK_STATE              BlockState,
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos);
+
+    //!
+    //! \brief    INTERNAL function to insert a block into a block list.
+    //! \details  Insert a block into a block list at a given position (head, tail, insert after block)
+    //!           Ensures that the list and the block position are both valid.
+    //!           Does not check if the block is still attached to another list.
+    //!           IMPORTANT: Block must be detached, at the risk of corrupting other block lists.
+    //!                      This function does not track state heap usage
+    //! \param    [in] pList
+    //!           Pointer to memory block list structure
+    //! \param    [in] BlockState
+    //!           New block state, defines the state of the new block,
+    //!           must match the state associated with the list and reference block
+    //! \param    [in] pBlock
+    //!           Pointer to memory block to be inserted
+    //! \param    [in] pBlockPos
+    //!           Pointer to memory block after which the block is to be inserted (inserted AFTER pBlockPos)
+    //!           If set to MHW_BLOCK_POSITION_HEAD, inserts block at the head of the list.
+    //!           If set to MHW_BLOCK_POSITION_TAIL, inserts block at the tail of the list.
+    //! \return   MOS_STATUS
+    //!           Returns error code
+    //!
+    MOS_STATUS AttachBlockInternal(
+        PMHW_BLOCK_LIST              pList,
+        MHW_BLOCK_STATE              BlockState,
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos);
+
+    //!
+    //! \brief    Removes a block from a memory block list
+    //! \details  Removes a block from a memory block list from a given 
+    //! \param    [in] BlockState
+    //!           Block state defines from which list the block is to be removed.
+    //! \param    [in] pBlockPos
+    //!           Defines the object in list to be detached.
+    //!           If set to MHW_BLOCK_POSITION_HEAD, detaches the first block in the list.
+    //!           If set to MHW_BLOCK_POSITION_TAIL, detaches the last block in the list.
+    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
+    //!           Returns a pointer to the block detached, nullptr if the list is empty or invalid.
+    //!
+    PMHW_STATE_HEAP_MEMORY_BLOCK DetachBlock(
+        MHW_BLOCK_STATE              BlockState,
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos);
+
+    //!
+    //! \brief    INTERNAL function to remove a block from a block list.
+    //! \details  Removes a block from a list provided. The caller may specify the block
+    //!           to remove, or request the head or tail of the list.
+    //!           Ensures that the list and the block position are both valid.
+    //!           Does not check if the block is still attached to another list.
+    //!           IMPORTANT: Block must be detached, at the risk of corrupting other block lists.
+    //!                      This function does not track state heap usage
+    //! \param    [in] pList
+    //!           Pointer to memory block list structure
+    //! \param    [in] pBlock
+    //!           Pointer to memory block to be inserted
+    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
+    //!           Returns block, nullptr if failure or no block available
+    //!
+    PMHW_STATE_HEAP_MEMORY_BLOCK DetachBlockInternal(
+        PMHW_BLOCK_LIST              pList,
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock);
+
+    //!
+    //! \brief    Interface to move block from one list to another
+    //! \details  Moves a block from a list into another
+    //!           Ensures that the list and the block position are both valid.
+    //!           Does not check if the block is still attached to another list.
+    //!           IMPORTANT: Block must be detached, at the risk of corrupting other block lists.
+    //!                      This function does not track state heap usage
+    //! \param    [in] pSrcList
+    //!           Pointer to source list
+    //! \param    [in] pDstList
+    //!           Pointer to destination list
+    //! \param    [in] pBlock
+    //!           Pointer to memory block to be moved
+    //! \param    [in] pBlockPos
+    //!           Pointer to memory block after which the block is to be inserted (inserted AFTER pBlockPos)
+    //!           If set to MHW_BLOCK_POSITION_HEAD, inserts block at the head of the list.
+    //!           If set to MHW_BLOCK_POSITION_TAIL, inserts block at the tail of the list.
+    //! \return   MOS_STATUS
+    //!           Returns error code
+    //!
+    MOS_STATUS MoveBlock(
+        PMHW_BLOCK_LIST              pSrcList,      // Source list
+        PMHW_BLOCK_LIST              pDstList,      // Destination list
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,        // Block to be moved (or HEAD/TAIL of source list)
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos);    // Position to insert (or HEAD/TAIL of target list)
+
+    //!
+    //! \brief    Returns memory block object to pool
+    //! \details  Returns memory block object to pool
+    //! \param    [in] pBlock
+    //!           Pointer to memory block to be returned back to pool
+    //! \return   N/A
+    //!
+    void ReturnBlockToPool(PMHW_STATE_HEAP_MEMORY_BLOCK pBlock);
+
+    //!
+    //! \brief    Consolidate free memory
+    //! \details  Consolidate free memory blocks adjacent to a given free block (within the same state heap).
+    //! \param    [in] pBlock
+    //!           Pointer to free memory block
+    //! \return    N/A
+    //!
+    void ConsolidateBlock(PMHW_STATE_HEAP_MEMORY_BLOCK pBlock);
+
+    //!
+    //! \brief    INTERNAL: Move block from free to allocated list
+    //! \details  Move block from free to allocated list, setting up pointer/offset to data
+    //! \param    [in] pBlock
+    //!           Pointer to free memory block
+    //! \param    uint32_t dwAlignment
+    //!           [in] Data alignment, assured to be power of 2 by caller
+    //! \return   MOS_STATUS
+    //!           Returns the status of the operation
+    //!
+    MOS_STATUS AllocateBlockInternal(
+        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
+        uint32_t                     dwAlignment);
+
+    //!
+    //! \brief    Split block internal
+    //! \details  Split block internal
+    //! \param    [in] pBlock
+    //!           Pointer to block to be splitted
+    //! \param    [in] dwSplitSize
+    //!           Size of the block to be splitted 
+    //! \param    [in] dwAlignment
+    //!           Data alignment, assured to be power of 2 by caller
+    //! \param    [in] bBackward
+    //!           if true, use higher part of the block
+    //! \return   MOS_STATUS
+    //!           Returns the status of the operation
+    //!
+    MOS_STATUS SplitBlockInternal(
+        PMHW_STATE_HEAP_MEMORY_BLOCK    pBlock,
+        uint32_t                        dwSplitSize,
+        uint32_t                        dwAlignment,
+        bool                            bBackward);
+
+    //!
+    //! \brief    Merge blocks
+    //! \details  Merge blocks
+    //! \param    [in]  pBlockL
+    //!           Pointer to block in lower memory
+    //! \param    [in]  pBlockH
+    //!           Pointer to block in higher memory
+    //! \param    [in] dwAlignment
+    //!           Data alignment, assured to be power of 2 by caller
+    //! \param    [in] bBackward
+    //!           if True, pBlcokL is merged into pBlockH
+    //!           if False, pBlockH is merged into pBlockL
+    //! \return   MOS_STATUS
+    //!           Returns the status of the operation
+    //!
+    MOS_STATUS MergeBlocksInternal(
+        PMHW_STATE_HEAP_MEMORY_BLOCK    pBlockL,
+        PMHW_STATE_HEAP_MEMORY_BLOCK    pBlockH,
+        uint32_t                        dwAlignment,
+        bool                            bBackward);
+
+    //!
+    //! \brief    ResizeBlock
+    //! \details  ResizeBlock
+    //! \param    [in] pBlock
+    //!           Pointer to block to be resized
+    //! \param    [in]   dwNewSize
+    //!           new size of block
+    //! \param    [in] dwAlignment
+    //!           Data alignment, assured to be power of 2 by caller
+    //! \param    [in] bBackward
+    //!           if True,  allow block to grow forward/backwards (moving its start offset)
+    //!           if False, Always grow/shrink forward;
+    //! \return   MOS_STATUS
+    //!           Returns the status of the operation
+    //!
+    MOS_STATUS ResizeBlock(
+        PMHW_STATE_HEAP_MEMORY_BLOCK    pBlock,
+        uint32_t                        dwNewSize,
+        uint32_t                        dwAlignment,
+        bool                            bBackward);
+};
+
+#endif // __MHW_BLOCK_MANAGER_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_blt.h 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_blt.h
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_blt.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_blt.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,493 @@
+/*
+* Copyright (c) 2020-2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     mhw_blt.h
+//! \brief    MHW interface for constructing commands for the BLT
+//!
+#ifndef __MHW_BLT_H__
+#define __MHW_BLT_H__
+
+#include "mos_os.h"
+#include "mhw_utilities.h"
+
+//!
+//! \brief  Fast copy blt parameters
+//!
+typedef struct _MHW_FAST_COPY_BLT_PARAM
+{
+    uint32_t        dwColorDepth;
+    uint32_t        dwSrcPitch;
+    uint32_t        dwDstPitch;
+    uint32_t        dwSrcTop;
+    uint32_t        dwSrcLeft;
+    uint32_t        dwDstTop;
+    uint32_t        dwDstBottom;
+    uint32_t        dwDstLeft;
+    uint32_t        dwDstRight;
+    PMOS_RESOURCE   pSrcOsResource;
+    PMOS_RESOURCE   pDstOsResource;
+}MHW_FAST_COPY_BLT_PARAM, *PMHW_FAST_COPY_BLT_PARAM;
+
+//!
+//! \brief  Control surface copy blt parameters
+//!
+typedef struct _MHW_CTRL_SURF_COPY_BLT_PARAM
+{
+    uint32_t        dwSrcMemoryType;
+    uint32_t        dwDstMemoryType;
+    uint32_t        dwSizeofControlSurface;
+    PMOS_RESOURCE   pSrcOsResource;
+    PMOS_RESOURCE   pDstOsResource;
+}MHW_CTRL_SURF_COPY_BLT_PARAM, *PMHW_CTRL_SURF_COPY_BLT_PARAM;
+
+typedef enum BLT_TILE_TYPE_ENUM
+{
+   BLT_TILED_X,
+   BLT_TILED_Y,
+   BLT_TILED_W,
+   BLT_NOT_TILED,
+   BLT_TILED_4,
+   BLT_TILED_64
+}BLT_TILE_TYPE;
+
+typedef enum _MHW_BLT_ENGINE_ADDRESS_SHIFT
+{
+    MHW_BLT_ENGINE_STATE_BASE_ADDRESS_SHIFT = 0
+} MHW_BLT_ENGINE_ADDRESS_SHIFT;
+
+class mhw_blt_state
+{
+public:
+     // Internal Macros
+    #define __CODEGEN_MAX(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
+    #define __CODEGEN_BITFIELD(l, h) (h) - (l) + 1
+    #define __CODEGEN_OP_LENGTH_BIAS 2
+    #define __CODEGEN_OP_LENGTH(x) (uint32_t)((__CODEGEN_MAX(x, __CODEGEN_OP_LENGTH_BIAS)) - __CODEGEN_OP_LENGTH_BIAS)
+
+    static uint32_t GetOpLength(uint32_t uiLength) { return __CODEGEN_OP_LENGTH(uiLength); }
+
+    //!
+    //! \brief XY_BLOCK_COPY_BLT
+    //! \details
+    //!     XY_BLOCK_COPY_BLT instruction performs a color source copy where the
+    //!     only operands involved are a color source and destination of the same
+    //!     bit width. The source and destination surfaces CAN overlap, the hardware
+    //!     handles this internally. This new blit command will happen in large
+    //!     numbers, consecutively, possibly an entire batch will comprise only new
+    //!     blit commands. Legacy commands and new blit command will not be
+    //!     interspersed. If they are, they will be separated by implied HW flush:
+    //!     Whenever there is a transition between this new Fast Blit command and
+    //!     the Legacy Blit commands (2D BLT instructions other than
+    //!     XY_BLOCK_COPY_BLT, XY_FAST_COPY_BLT, XY_FAST_COLOR_BLT), the HW will
+    //!     impose an automatic flush BEFORE the execution (at the beginning) of the
+    //!     next blitter command. The starting pixel of the blit operation for both
+    //!     source and destination should be on a pixel boundary.
+    //!     Note that when two sequential block copy blits have different source
+    //!     surfaces, but their destinations refer to the same destination surfaces
+    //!     and therefore destinations overlap it is imperative that a Flush be
+    //!     inserted between the two blits.
+    //!     
+    struct XY_BLOCK_COPY_BLT_CMD
+    {
+        union
+        {
+            struct
+            {
+                uint32_t                 DwordLength                                      : __CODEGEN_BITFIELD( 0,  7)    ; //!< DWORD_LENGTH
+                uint32_t                 Reserved8                                        : __CODEGEN_BITFIELD( 8, 18)    ; //!< Reserved
+                uint32_t                 ColorDepth                                       : __CODEGEN_BITFIELD(19, 21)    ; //!< COLOR_DEPTH
+                uint32_t                 InstructionTargetOpcode                          : __CODEGEN_BITFIELD(22, 28)    ; //!< INSTRUCTION_TARGETOPCODE
+                uint32_t                 Client                                           : __CODEGEN_BITFIELD(29, 31)    ; //!< CLIENT
+            };
+            uint32_t                     Value;
+        } DW0;
+        union
+        {
+            struct
+            {
+                uint32_t                 DestinationPitch                                 : __CODEGEN_BITFIELD( 0, 17)    ; //!< Destination Pitch
+                uint32_t                 Reserved50                                       : __CODEGEN_BITFIELD(18, 20)    ; //!< Reserved
+                uint32_t                 DestinationMocsValue                             : __CODEGEN_BITFIELD(21, 27)    ; //!< Destination MOCS value
+                uint32_t                 Reserved60                                       : __CODEGEN_BITFIELD(28, 29)    ; //!< Reserved
+                uint32_t                 DestinationTiling                                : __CODEGEN_BITFIELD(30, 31)    ; //!< DESTINATION_TILING
+            };
+            uint32_t                     Value;
+        } DW1;
+        union
+        {
+            struct
+            {
+                uint32_t                 DestinationX1CoordinateLeft                      : __CODEGEN_BITFIELD( 0, 15)    ; //!< Destination X1 Coordinate (Left)
+                uint32_t                 DestinationY1CoordinateTop                       : __CODEGEN_BITFIELD(16, 31)    ; //!< Destination Y1 Coordinate (Top)
+            };
+            uint32_t                     Value;
+        } DW2;
+        union
+        {
+            struct
+            {
+                uint32_t                 DestinationX2CoordinateRight                     : __CODEGEN_BITFIELD( 0, 15)    ; //!< Destination X2 Coordinate (Right)
+                uint32_t                 DestinationY2CoordinateBottom                    : __CODEGEN_BITFIELD(16, 31)    ; //!< Destination Y2 Coordinate (Bottom)
+            };
+            uint32_t                     Value;
+        } DW3;
+        union
+        {
+            struct
+            {
+                uint64_t                 DestinationBaseAddress                                                           ; //!< Destination Base Address
+            };
+            uint32_t                     Value[2];
+        } DW4_5;
+        union
+        {
+            struct
+            {
+                uint32_t                 DestinationXOffset                               : __CODEGEN_BITFIELD( 0, 13)    ; //!< Destination X offset
+                uint32_t                 Reserved206                                      : __CODEGEN_BITFIELD(14, 15)    ; //!< Reserved
+                uint32_t                 DestinationYOffset                               : __CODEGEN_BITFIELD(16, 29)    ; //!< Destination Y offset
+                uint32_t                 Reserved222                                      : __CODEGEN_BITFIELD(30, 31)    ; //!< Reserved
+            };
+            uint32_t                     Value;
+        } DW6;
+        union
+        {
+            struct
+            {
+                uint32_t                 SourceX1CoordinateLeft                           : __CODEGEN_BITFIELD( 0, 15)    ; //!< Source X1 Coordinate (Left)
+                uint32_t                 SourceY1CoordinateTop                            : __CODEGEN_BITFIELD(16, 31)    ; //!< Source Y1 Coordinate (Top)
+            };
+            uint32_t                     Value;
+        } DW7;
+        union
+        {
+            struct
+            {
+                uint32_t                 SourcePitch                                      : __CODEGEN_BITFIELD( 0, 17)    ; //!< Source Pitch
+                uint32_t                 Reserved274                                      : __CODEGEN_BITFIELD(18, 20)    ; //!< Reserved
+                uint32_t                 SourceMocs                                       : __CODEGEN_BITFIELD(21, 27)    ; //!< Source MOCS
+                uint32_t                 Reserved284                                      : __CODEGEN_BITFIELD(28, 29)    ; //!< Reserved
+                uint32_t                 SourceTiling                                     : __CODEGEN_BITFIELD(30, 31)    ; //!< SOURCE_TILING
+            };
+            uint32_t                     Value;
+        } DW8;
+        union
+        {
+            struct
+            {
+                uint64_t                 SourceBaseAddress                                                                ; //!< Source Base Address
+            };
+            uint32_t                     Value[2];
+        } DW9_10;
+        union
+        {
+            struct
+            {
+                uint32_t                 SourceXOffset                                    : __CODEGEN_BITFIELD( 0, 13)    ; //!< Source X offset
+                uint32_t                 Reserved366                                      : __CODEGEN_BITFIELD(14, 15)    ; //!< Reserved
+                uint32_t                 SourceYOffset                                    : __CODEGEN_BITFIELD(16, 29)    ; //!< Source Y offset
+                uint32_t                 Reserved382                                      : __CODEGEN_BITFIELD(30, 31)    ; //!< Reserved
+            };
+            uint32_t                     Value;
+        } DW11;
+
+        //! \name Local enumerations
+
+        //! \brief COLOR_DEPTH
+        //! \details
+        //!     This field actually programs bits per pixel value for each pixel of
+        //!     the surface. Reprogramming of these bits require explicit flushing of
+        //!     Copy Engine.
+        enum COLOR_DEPTH
+        {
+            COLOR_DEPTH_8BITCOLOR                                            = 0, //!< No additional details
+            COLOR_DEPTH_16BITCOLOR                                           = 1, //!< No additional details
+            COLOR_DEPTH_32BITCOLOR                                           = 2, //!< No additional details
+            COLOR_DEPTH_64BITCOLOR                                           = 3, //!< No additional details
+            COLOR_DEPTH_96BITCOLOR_ONLYLINEARCASEISSUPPORTED                 = 4, //!< No additional details
+            COLOR_DEPTH_128BITCOLOR                                          = 5, //!< No additional details
+        };
+
+        enum INSTRUCTION_TARGETOPCODE
+        {
+            INSTRUCTION_TARGETOPCODE_INSTRUCTIONTARGETXYBLOCKCOPYBLT         = 65, //!< No additional details
+        };
+
+        enum CLIENT
+        {
+            CLIENT_2DPROCESSOR                                               = 2, //!< No additional details
+        };
+
+        //! \brief DESTINATION_TILING
+        //! \details
+        //!     These bits indicate destination tiling method.
+        enum DESTINATION_TILING
+        {
+            DESTINATION_TILING_LINEAR                                        = 0, //!< Linear mode (no tiling)
+            DESTINATION_TILING_YMAJOR                                        = 1, //!< Y major tiling
+        };
+
+        //! \brief SOURCE_TILING
+        //! \details
+        //!     These bits indicate source tiling method.
+        enum SOURCE_TILING
+        {
+            SOURCE_TILING_LINEAR                                             = 0, //!< Linear Tiling (tiking disabled)
+            SOURCE_TILING_YMAJOR                                             = 1, //!< Y major tiling
+        };
+
+        //! \name Initializations
+
+        //! \brief Explicit member initialization function
+        XY_BLOCK_COPY_BLT_CMD();
+
+        static const size_t dwSize = 12;
+        static const size_t byteSize = 48;
+    };
+
+    //!
+    //! \brief XY_FAST_COPY_BLT
+    //! \details
+    //!     This BLT instruction performs a color source copy where the only
+    //!     operands involved are a color source and destination of the same bit
+    //!     width. The source and destination surfaces CANNOT overlap. The hardware
+    //!     assumes this whenever this Fast_Copy command is given to it. For
+    //!     overlapping Blits, use the traditional XY_SRC_COPY_BLT command (for
+    //!     overlap determination, read the description given in the XY_SRC_COPY_BLT
+    //!     command). Note that this command does not support Clipping operations.
+    //!     This new blit command will happen in large numbers, consecutively,
+    //!     possibly an entire batch will comprise only new blit commands Legacy
+    //!     commands and new blit command will not be interspersed. If they are,
+    //!     they will be separated by implied HW flush: Whenever there is a
+    //!     transition between this new Fast Blit command and the Legacy Blit
+    //!     commands (2D BLT instructions other than XY_BLOCK_COPY_BLT,
+    //!     XY_FAST_COPY_BLT and XY_FAST_COLOR_BLT), the HW will impose an automatic
+    //!     flush BEFORE the execution (at the beginning) of the next blitter
+    //!     command. New blit command can use any combination of memory surface type
+    //!     - linear, tiledX, tiledY, and the tiling information is conveyed as part
+    //!     of the new Fast Copy command. The Fast Copy Blit supports the new 64KB
+    //!     Tiling defined for SKL.The starting pixel of Fast Copy blit for both
+    //!     source and destination should be on an OWord boundary.
+    //!     Note that when two sequential fast copy blits have different source
+    //!     surfaces, but their destinations refer to the same destination surfaces
+    //!     and therefore destinations overlap it is imperative that a Flush be
+    //!     inserted between the two blits.
+    //!
+
+    struct XY_FAST_COPY_BLT_CMD
+    {
+        union
+        {
+            struct
+            {
+                uint32_t                 DwordLength                                      : __CODEGEN_BITFIELD( 0,  7)    ; //!< DWORD_LENGTH
+                uint32_t                 Reserved8                                        : __CODEGEN_BITFIELD( 8, 12)    ; //!< Reserved
+                uint32_t                 DestinationTilingMethod                          : __CODEGEN_BITFIELD(13, 14)    ; //!< DESTINATION_TILING_METHOD
+                uint32_t                 Reserved15                                       : __CODEGEN_BITFIELD(15, 19)    ; //!< Reserved
+                uint32_t                 SourceTilingMethod                               : __CODEGEN_BITFIELD(20, 21)    ; //!< SOURCE_TILING_METHOD
+                uint32_t                 InstructionTargetOpcode                          : __CODEGEN_BITFIELD(22, 28)    ; //!< INSTRUCTION_TARGETOPCODE
+                uint32_t                 Client                                           : __CODEGEN_BITFIELD(29, 31)    ; //!< CLIENT
+            };
+            uint32_t                     Value;
+        } DW0;
+        union
+        {
+            struct
+            {
+                uint32_t                 DestinationPitch                                 : __CODEGEN_BITFIELD( 0, 15)    ; //!< Destination Pitch
+                uint32_t                 Reserved48                                       : __CODEGEN_BITFIELD(16, 23)    ; //!< Reserved
+                uint32_t                 ColorDepth                                       : __CODEGEN_BITFIELD(24, 26)    ; //!< COLOR_DEPTH
+                uint32_t                 Reserved59                                       : __CODEGEN_BITFIELD(27, 29)    ; //!< Reserved
+                uint32_t                 TileYTypeForDestination                          : __CODEGEN_BITFIELD(30, 30)    ; //!< TILE_Y_TYPE_FOR_DESTINATION
+                uint32_t                 TileYTypeForSource                               : __CODEGEN_BITFIELD(31, 31)    ; //!< TILE_Y_TYPE_FOR_SOURCE
+            };
+            uint32_t                     Value;
+        } DW1;
+        union
+        {
+            struct
+            {
+                uint32_t                 DestinationX1CoordinateLeft                      : __CODEGEN_BITFIELD( 0, 15)    ; //!< Destination X1 Coordinate (Left)
+                uint32_t                 DestinationY1CoordinateTop                       : __CODEGEN_BITFIELD(16, 31)    ; //!< Destination Y1 Coordinate (Top)
+            };
+            uint32_t                     Value;
+        } DW2;
+        union
+        {
+            struct
+            {
+                uint32_t                 DestinationX2CoordinateRight                     : __CODEGEN_BITFIELD( 0, 15)    ; //!< Destination X2 Coordinate (Right)
+                uint32_t                 DestinationY2CoordinateBottom                    : __CODEGEN_BITFIELD(16, 31)    ; //!< Destination Y2 Coordinate (Bottom)
+            };
+            uint32_t                     Value;
+        } DW3;
+        union
+        {
+            struct
+            {
+                uint64_t                 DestinationBaseAddress                                                           ; //!< Destination Base Address
+            };
+            uint32_t                     Value[2];
+        } DW4_5;
+        union
+        {
+            struct
+            {
+                uint32_t                 SourceX1CoordinateLeft                           : __CODEGEN_BITFIELD( 0, 15)    ; //!< Source X1 Coordinate (Left)
+                uint32_t                 SourceY1CoordinateTop                            : __CODEGEN_BITFIELD(16, 31)    ; //!< Source Y1 Coordinate (Top)
+            };
+            uint32_t                     Value;
+        } DW6;
+        union
+        {
+            struct
+            {
+                uint32_t                 SourcePitch                                      : __CODEGEN_BITFIELD( 0, 15)    ; //!< Source Pitch
+                uint32_t                 Reserved240                                      : __CODEGEN_BITFIELD(16, 31)    ; //!< Reserved
+            };
+            uint32_t                     Value;
+        } DW7;
+        union
+        {
+            struct
+            {
+                uint64_t                 SourceBaseAddress                                                                ; //!< Source Base Address
+            };
+            uint32_t                     Value[2];
+        } DW8_9;
+
+        //! \name Local enumerations
+
+        //! \brief DESTINATION_TILING_METHOD
+        //! \details
+        //!     SW is required to flush the HW before changing the polarity of these
+        //!     bits for subsequent blits.
+        enum DESTINATION_TILING_METHOD
+        {
+            DESTINATION_TILING_METHOD_LINEAR_TILINGDISABLED                  = 0, //!< No additional details
+            DESTINATION_TILING_METHOD_LEGACYTILE_X                           = 1, //!< No additional details
+            DESTINATION_TILING_METHOD_TILE_Y                                 = 2, //!< Choosing between 'Legacy Tile-Y' or the 'New 4K Tile-YF' can be done in DWord 1, Bit[30].
+            DESTINATION_TILING_METHOD_64KBTILING                             = 3, //!< No additional details
+        };
+
+        //! \brief SOURCE_TILING_METHOD
+        //! \details
+        //!     SW is required to flush the HW before changing the polarity of these
+        //!     bits for subsequent blits.
+        enum SOURCE_TILING_METHOD
+        {
+            SOURCE_TILING_METHOD_LINEAR_TILINGDISABLED                       = 0, //!< No additional details
+            SOURCE_TILING_METHOD_LEGACYTILE_X                                = 1, //!< No additional details
+            SOURCE_TILING_METHOD_TILE_Y                                      = 2, //!< Choosing between 'Legacy Tile-Y' or the 'New 4K Tile-YF' can be done in DWord 1, Bit[31].
+            SOURCE_TILING_METHOD_64KBTILING                                  = 3, //!< No additional details
+        };
+
+        enum INSTRUCTION_TARGETOPCODE
+        {
+            INSTRUCTION_TARGETOPCODE_UNNAMED66                               = 66, //!< No additional details
+        };
+
+        enum CLIENT
+        {
+            CLIENT_2DPROCESSOR                                               = 2, //!< No additional details
+        };
+
+        enum COLOR_DEPTH
+        {
+            COLOR_DEPTH_8BITCOLOR                                            = 0, //!< No additional details
+            COLOR_DEPTH_16BITCOLOR_565                                       = 1, //!< No additional details
+            COLOR_DEPTH_32BITCOLOR                                           = 3, //!< No additional details
+            COLOR_DEPTH_64BITCOLOR_FOR64KBTILING                             = 4, //!< No additional details
+            COLOR_DEPTH_128BITCOLOR_FOR64KBTILING                            = 5, //!< No additional details
+        };
+
+        //! \brief TILE_Y_TYPE_FOR_DESTINATION
+        //! \details
+        //!     Destination being Tile-Y can be selected in DWord 0, Bit[14:13].
+        enum TILE_Y_TYPE_FOR_DESTINATION
+        {
+            TILE_Y_TYPE_FOR_DESTINATION_NEW4KTILE_YF                         = 1, //!< No additional details
+        };
+
+        //! \brief TILE_Y_TYPE_FOR_SOURCE
+        //! \details
+        //!     Source being Tile-Y can be selected in DWord 0, Bit[21:20].
+        enum TILE_Y_TYPE_FOR_SOURCE
+        {
+            TILE_Y_TYPE_FOR_SOURCE_NEW4KTILE_YF                              = 1, //!< No additional details
+        };
+
+        //! \name Initializations
+
+        //! \brief Explicit member initialization function
+        XY_FAST_COPY_BLT_CMD();
+
+        static const size_t dwSize = 10;
+        static const size_t byteSize = 40;
+    };
+
+    //////////////////////////////////////////////////////////////////////////
+    /// @brief BCS_SWCTRL
+    /// @details
+    ///
+    ///
+    struct BCS_SWCTRL_CMD
+    {
+     union
+     {
+      struct
+      {
+       /// DWORD 0
+       uint32_t                 TileYSource : __CODEGEN_BITFIELD(0, 0); ///< U1
+       uint32_t                 TileYDestination : __CODEGEN_BITFIELD(1, 1); ///< U1
+       uint32_t                 NotInvalidateBlitterCacheonBCSFlush : __CODEGEN_BITFIELD(2, 2); ///< U1
+       uint32_t                 ShrinkBlitterCache : __CODEGEN_BITFIELD(3, 3); ///< U1
+       uint32_t                 Reserved_4 : __CODEGEN_BITFIELD(4, 15); ///< U12
+       uint32_t                 TileYSourceMask : __CODEGEN_BITFIELD(16, 16); ///< U1
+       uint32_t                 TileYDestinationMask : __CODEGEN_BITFIELD(17, 17); ///< U1
+       uint32_t                 Mask : __CODEGEN_BITFIELD(18, 31); ///< U16
+
+      };
+      uint32_t                     Value;
+     } DW0;
+
+     //////////////////////////////////////////////////////////////////////////
+     /// @name LOCAL ENUMERATIONS
+     /// @{
+
+     /// @brief
+     enum CONSTANTS_TYPE
+     {
+      COMMAND_LENGTH = 1, ///<
+      REGISTER_OFFSET = 0x22200, ///<
+     };
+     //! \name Initializations
+
+     //! \brief Explicit member initialization function
+     BCS_SWCTRL_CMD();
+
+     static const size_t dwSize = 1;
+     static const size_t byteSize = 4;
+    };
+};
+
+#endif  // __MHW_BLT_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_memory_pool.h 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_memory_pool.h
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_memory_pool.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_memory_pool.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2015-2017, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file      mhw_memory_pool.h 
+//! \brief         This modules implements simple memory pool infrastructure for MHW 
+//!
+#ifndef __MHW_MEMORY_POOL_H__
+#define __MHW_MEMORY_POOL_H__
+
+#include "mos_os.h"
+
+typedef struct _MHW_MEMORY_POOL_ENTRY *PMHW_MEMORY_POOL_ENTRY;
+typedef struct MHW_MEMORY_POOL *PMHW_MEMORY_POOL;
+
+struct MHW_MEMORY_POOL
+{
+
+    PMHW_MEMORY_POOL_ENTRY  m_pFirst;             //!< First pool
+    PMHW_MEMORY_POOL_ENTRY  m_pLast;              //!< Last pool
+    uint32_t                m_dwCount;            //!< Number of pools
+    uint32_t                m_dwSize;             //!< Total memory in all pool objects
+    uint32_t                m_dwObjSize;          //!< Object size
+    uint32_t                m_dwObjAlignment;     //!< Object alignment
+    uint32_t                m_dwObjCount;         //!< Total number of objects in all pools
+
+    //!
+    //! \brief    Constructor of MHW_MEMORY_POOL
+    //! \details  Constructor of MHW_BLOCK_MANAGER which initializes all members
+    //! \param    [in] dwObjSize
+    //!           Size of object
+    //! \param    [in] dwObjAlignment
+    //!           Alignment of object
+    //!
+    MHW_MEMORY_POOL(uint32_t dwObjSize, uint32_t dwObjAlignment);
+
+    //!
+    //! \brief    Destructor of MHW_MEMORY_POOL
+    //! \details  Destructor of MHW_MEMORY_POOL which releases all the elements in the list
+    //!
+    ~MHW_MEMORY_POOL();
+
+    //!
+    //! \brief    Allocate objects 
+    //! \details  Allocate objects and insert them into list
+    //! \param    [in] dwObjCount
+    //!           Count of objects need to be allocated
+    //!
+    void  *Allocate(uint32_t dwObjCount);
+
+} ;
+
+#endif // __MHW_MEMORY_POOL_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_mi.h 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_mi.h
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_mi.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_mi.h	2022-07-19 15:03:31.000000000 +0000
@@ -28,13 +28,14 @@
 #ifndef __MHW_MI_H__
 #define __MHW_MI_H__
 
-class MhwCpInterface;
-
+#include <memory>
+#include "mos_defs.h"
 #include "mos_os.h"
-#include "mhw_utilities.h"
-#include "mhw_cp_interface.h"
 #include "mhw_mmio.h"
-#include "mhw_mi_itf.h"
+#include "mhw_utilities_next.h"
+#include "mos_os_specific.h"
+
+class MhwCpInterface;
 
 #define MHW_MI_WATCHDOG_ENABLE_COUNTER                  0x0
 #define MHW_MI_WATCHDOG_DISABLE_COUNTER                 0x1
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_render.h 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_render.h
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_render.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_render.h	2022-07-19 15:03:31.000000000 +0000
@@ -29,9 +29,7 @@
 #define __MHW_RENDER_H__
 
 #include "mos_os.h"
-#include "mhw_utilities.h"
 #include "mhw_state_heap.h"
-#include "mhw_mi.h"
 #include "mhw_render_itf.h"
 
 #define MHW_RENDER_ENGINE_SSH_SURFACES_PER_BT_MAX           256
@@ -306,444 +304,4 @@ typedef struct _MHW_MEDIA_OBJECT_PARAMS
     MHW_VFE_SCOREBOARD                  VfeScoreboard;
 } MHW_MEDIA_OBJECT_PARAMS, *PMHW_MEDIA_OBJECT_PARAMS;
 
-class MhwRenderInterface
-{
-public:
-    PMHW_STATE_HEAP_INTERFACE m_stateHeapInterface = nullptr;
-
-    virtual ~MhwRenderInterface()
-    {
-        if (m_stateHeapInterface)
-        {
-            m_stateHeapInterface->pfnDestroy(m_stateHeapInterface);
-        }
-    }
-
-    //!
-    //! \brief    Allocates the MHW render interface internal parameters
-    //! \details  Internal MHW function to allocate all parameters needed for the
-    //!           render interface including the state heap interface
-    //! \param    MHW_STATE_HEAP_SETTINGS stateHeapSettings
-    //!           [in] Setting used to initialize the state heap interface
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS AllocateHeaps(
-        MHW_STATE_HEAP_SETTINGS         stateHeapSettings);
-
-    //!
-    //! \brief    Adds PIPELINE_SELECT to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which commands are added
-    //! \param    gpGpuPipe
-    //!           [in] false: MEDIA pipe; true:  GPGPU pipe
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddPipelineSelectCmd (
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        bool                            gpGpuPipe) = 0;
-
-    //!
-    //! \brief    Adds STATE_BASE_ADDRESS to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddStateBaseAddrCmd(
-        PMOS_COMMAND_BUFFER                 cmdBuffer,
-        PMHW_STATE_BASE_ADDR_PARAMS         params) = 0;
-
-    //!
-    //! \brief    Adds MEDIA_VFE_STATE to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddMediaVfeCmd (
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_VFE_PARAMS                 params) = 0;
-
-    //!
-    //! \brief    Adds CFE_STATE to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddCfeStateCmd(
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_VFE_PARAMS                 params)
-    {
-        MOS_UNUSED(cmdBuffer);
-        MOS_UNUSED(params);
-
-        // CFE_STATE will replace the MEDIA_VFE_STATE on some platform; Just keep the
-        // platform which really uses CFE to implement it on inheriting class .
-        MHW_ASSERTMESSAGE("Don't support it on this platform");
-        return MOS_STATUS_SUCCESS;
-    }
-
-    //!
-    //! \brief    Adds MEDIA_CURBE_LOAD to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddMediaCurbeLoadCmd(
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_CURBE_LOAD_PARAMS          params) = 0;
-
-    //!
-    //! \brief    Adds MEDIA_INTERFACE_DESCRIPTOR_LOAD to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddMediaIDLoadCmd(
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_ID_LOAD_PARAMS             params) = 0;
-
-    //!
-    //! \brief    Adds MEDIA_OBJECT to the buffer provided
-    //! \details  MEDIA_OBJCET is added to either the command buffer or
-    //!           batch buffer (whichever is valid)
-    //! \param    cmdBuffer
-    //!           [in] If valid, command buffer to which HW command is added
-    //! \param    batchBuffer
-    //!           [in] If valid, Batch buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddMediaObject(
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_BATCH_BUFFER               batchBuffer,
-        PMHW_MEDIA_OBJECT_PARAMS        params) = 0;
-
-    //!
-    //! \brief    Adds MEDIA_OBJECT_WALKER to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddMediaObjectWalkerCmd(
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_WALKER_PARAMS              params) = 0;
-
-    //!
-    //! \brief    Adds GPGPU_WALKER to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddGpGpuWalkerStateCmd(
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_GPGPU_WALKER_PARAMS        params) = 0;
-
-    //!
-    //! \brief    Adds 3DSTATE_CHROMA_KEY to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddChromaKeyCmd(
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_CHROMAKEY_PARAMS           params) = 0;
-
-    //!
-    //! \brief    Adds 3DSTATE_SAMPLER_PALETTE_LOADX to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddPaletteLoadCmd(
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_PALETTE_PARAMS             params) = 0;
-
-    //!
-    //! \brief    Adds STATE_SIP to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    params
-    //!           [in] Params structure used to populate the HW command
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddSipStateCmd(
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_SIP_STATE_PARAMS           params) = 0;
-
-    //!
-    //! \brief    Adds GPGPU_CSR_BASE_ADDRESS to the command buffer
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW command is added
-    //! \param    csrResource
-    //!           [in] Resource to be used for GPGPU CSR
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddGpgpuCsrBaseAddrCmd(
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMOS_RESOURCE                   csrResource) = 0;
-
-    //!
-    //! \brief    get the size of hw command
-    //! \details  Internal function to get the size of MEDIA_OBJECT_CMD
-    //! \return   commandSize
-    //!           The command size
-    //!
-    virtual uint32_t GetMediaObjectCmdSize() = 0;
-
-    //!
-    //! \brief    Enables L3 cacheing flag and sets related registers/values
-    //! \param    cacheSettings
-    //!           [in] L3 Cache Configurations, if a null pointer is passed 
-    //!           in, it will use default settings.
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS EnableL3Caching(
-        PMHW_RENDER_ENGINE_L3_CACHE_SETTINGS    cacheSettings) = 0;
-
-    //!
-    //! \brief    Setup L3 cache configuration for kernel workload
-    //! \details  Enable L3 cacheing in kernel workload by configuring the
-    //!           appropriate MMIO registers.
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW commands is added
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS SetL3Cache(
-        PMOS_COMMAND_BUFFER             cmdBuffer) = 0;
-
-    //!
-    //! \brief    Enables preemption for media workloads on render engine
-    //! \details  Sets the MMIO register for preemption so that HW can preempt
-    //!           the submitted workload if required
-    //! \param    cmdBuffer
-    //!           [in] Command buffer to which HW commands is added
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS EnablePreemption(
-        PMOS_COMMAND_BUFFER             cmdBuffer);
-
-    //!
-    //! \brief    Accessor for m_l3CacheConfig
-    //! \return   L3 cache configuration information
-    //!
-    virtual MHW_RENDER_ENGINE_L3_CACHE_CONFIG* GetL3CacheConfig() = 0;
-
-    //!
-    //! \brief    Accessor for m_hwCaps, temporarily returns pointer to m_hwCaps until clients move to using not a pointer
-    //! \return   Pointer to HW capabilities
-    //!
-    MHW_RENDER_ENGINE_CAPS *GetHwCaps() { return &m_hwCaps; }
-
-    //!
-    //! \brief    Accessor for m_preemptionEnabled
-    //! \return   true if preemption is enabled, false otherwise
-    //!
-    bool IsPreemptionEnabled() { return m_preemptionEnabled; }
-
-    //!
-    //! \brief    Setter for os interface, used in MFE scenario
-    //! \return   void
-    //!
-    void SetOsInterface(PMOS_INTERFACE osInterface) { m_osInterface = osInterface;}
-
-    //!
-    //! \brief    Get mmio registers address
-    //! \details  Get mmio registers address
-    //! \return   [out] PMHW_MI_MMIOREGISTERS*
-    //!           mmio registers got.
-    //!
-    virtual PMHW_MI_MMIOREGISTERS GetMmioRegisters() = 0;
-
-    //!
-    //! \brief    Get AVS sampler state Inc unit
-    //! \details  Get AVS sampler state Inc unit
-    //! \return   [out] uint32_t
-    //!           AVS sampler unit.
-    virtual uint32_t GetSamplerStateAVSIncUnit() = 0;
-
-    //!
-    //! \brief    Get Conv sampler state Inc unit
-    //! \details  Get Conv sampler state Inc unit
-    //! \return   [out] uint32_t
-    //!           Conv sampler unit.
-    virtual uint32_t GetSamplerStateConvIncUnit() = 0;
-
-    //!
-    //! \brief    Get the sampler height and width align unit
-    //! \details  NV12 format needs the width and height to be a multiple of some unit
-    //! \param    [in] bool
-    //!           true if AVS sampler, false otherwise
-    //! \param    [in, out] uint32_t
-    //!           weight align unit
-    //! \param    [in, out] uint32_t
-    //!           height align unit
-    virtual void GetSamplerResolutionAlignUnit(bool isAVSSampler, uint32_t &widthAlignUnit, uint32_t &heightAlignUnit) = 0;
-
-    //!
-    //! \brief    Get new render interface, temporal solution before switching from
-    //!           old interface to new one
-    //!
-    //! \return   pointer to new render interface
-    //!
-    virtual std::shared_ptr<mhw::render::Itf> GetNewRenderInterface() { return nullptr; }
-
-protected:
-    //!
-    //! \brief    Initializes the Render interface
-    //! \details  Internal MHW function to initialize all function pointers and some parameters
-    //!           Assumes that the caller has checked pointer validity and whether or not an
-    //!           addressing method has been selected in the OS interface (bUsesGfxAddress or
-    //!           bUsesPatchList).
-    //! \param    [in] miInterface
-    //!           MI interface, must be valid
-    //! \param    [in] osInterface
-    //!           OS interface, must be valid
-    //! \param    [in] gtSystemInfo
-    //!           System information, must be valid
-    //! \param    [in] newStateHeapManagerRequested
-    //!           A new state heap manager was implemented for MDF, will be adapted for codec & VP,
-    //!           migrated to C++, rolled into the existing state heap interface and removed.
-    //!           Ultimately this parameter will no longer be necessary as the state heap interface
-    //!           will be unified.
-    //!
-    MhwRenderInterface(
-        MhwMiInterface          *miInterface,
-        PMOS_INTERFACE          osInterface,
-        MEDIA_SYSTEM_INFO       *gtSystemInfo,
-        uint8_t                 newStateHeapManagerRequested)
-    {
-        MHW_FUNCTION_ENTER;
-
-        if (miInterface == nullptr ||
-            osInterface == nullptr ||
-            gtSystemInfo == nullptr)
-        {
-            MHW_ASSERTMESSAGE("Invalid input pointers provided");
-            return;
-        }
-
-        if (!osInterface->bUsesGfxAddress && !osInterface->bUsesPatchList)
-        {
-            MHW_ASSERTMESSAGE("No valid addressing mode indicated");
-            return;
-        }
-
-        m_osInterface = osInterface;
-        m_miInterface = miInterface;
-        m_stateHeapInterface = nullptr;
-
-        memset(&m_hwCaps, 0, sizeof(m_hwCaps));
-
-        if (m_osInterface->bUsesGfxAddress)
-        {
-            AddResourceToCmd = Mhw_AddResourceToCmd_GfxAddress;
-        }
-        else // if (m_osInterface->bUsesPatchList)
-        {
-            AddResourceToCmd = Mhw_AddResourceToCmd_PatchList;
-        }
-
-        InitPlatformCaps(gtSystemInfo);
-
-        InitPreemption();
-
-        if (Mhw_StateHeapInterface_InitInterface(
-            &m_stateHeapInterface,
-            m_osInterface,
-            newStateHeapManagerRequested) != MOS_STATUS_SUCCESS)
-        {
-            MHW_ASSERTMESSAGE("State heap initialization failed!");
-            return;
-        }
-    }
-
-    PMOS_INTERFACE      m_osInterface = nullptr;
-    MEDIA_FEATURE_TABLE *m_skuTable = nullptr;
-    MhwMiInterface      *m_miInterface = nullptr;
-
-    MHW_RENDER_ENGINE_L3_CACHE_CONFIG   m_l3CacheConfig;
-    MHW_RENDER_ENGINE_CAPS              m_hwCaps;
-
-    bool        m_preemptionEnabled = false;
-    uint32_t    m_preemptionCntlRegisterOffset = 0;
-    uint32_t    m_preemptionCntlRegisterValue = 0;
-
-    uint32_t    m_l3CacheCntlRegisterOffset = M_L3_CACHE_CNTL_REG_OFFSET;
-    uint32_t    m_l3CacheCntlRegisterValueDefault = M_L3_CACHE_CNTL_REG_VALUE_DEFAULT;
-    std::shared_ptr <mhw::render::Itf> m_renderItfNew = nullptr;
-
-    //!
-    //! \brief    Adds a resource to the command buffer or indirect state (SSH)
-    //! \details  Internal MHW function to add either a graphics address of a resource or
-    //!           add the resource to the patch list for the requested buffer or state
-    //! \param    [in] osInterface
-    //!           OS interface
-    //! \param    [in] cmdBuffer
-    //!           If adding a resource to the command buffer, the buffer to which the resource
-    //!           is added
-    //! \param    [in] params
-    //!           Parameters necessary to add the graphics address
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS(*AddResourceToCmd) (
-        PMOS_INTERFACE                  osInterface,
-        PMOS_COMMAND_BUFFER             cmdBuffer,
-        PMHW_RESOURCE_PARAMS            params);
-
-    //!
-    //! \brief    Initializes platform related capabilities for the render engine
-    //! \details  Assumes the caller checked the pointers for validity.
-    //! \param    gtSystemInfo
-    //!           [in] Information concerning the GPU
-    //! \return   void
-    //!
-    void InitPlatformCaps(
-        MEDIA_SYSTEM_INFO         *gtSystemInfo);
-
-    //!
-    //! \brief    Initializes preemption related registers/values
-    //! \details  Initializes the MMIO register for preemption so that HW can preempt
-    //!           the submitted workload if required.
-    //! \return   void
-    //!           If invalid SKU\WA tables detected, does not do anything
-    //!
-    void InitPreemption();
-};
-
 #endif // __MHW_RENDER_H__
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_sfc.h 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_sfc.h
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_sfc.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_sfc.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,622 @@
+/*
+* Copyright (c) 2014-2017, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     mhw_sfc.h
+//! \brief    MHW interface for constructing commands for the SFC
+//! \details  Impelements the functionalities common across all platforms for MHW_SFC
+//!
+#ifndef __MHW_SFC_H__
+#define __MHW_SFC_H__
+
+#include "mhw_cp_interface.h"
+#include "mhw_state_heap.h"
+#include "mhw_utilities.h"
+#include "mos_os.h"
+#include "codec_def_common.h"
+#include "codec_def_decode_jpeg.h"
+
+static const int   MHW_SFC_CACHELINE_SIZE    = 64;
+static const int   MHW_SFC_MIN_HEIGHT        = 128;
+static const int   MHW_SFC_MIN_WIDTH         = 128;
+static const int   MHW_SFC_MAX_HEIGHT        = 4096;
+static const int   MHW_SFC_MAX_WIDTH         = 4096;
+static const int   MHW_SFC_VE_HEIGHT_ALIGN   = 4;
+static const int   MHW_SFC_VE_WIDTH_ALIGN    = 16;
+static const float MHW_SFC_MIN_SCALINGFACTOR = (1.0F / 8.0F);
+static const float MHW_SFC_MAX_SCALINGFACTOR = 8.0F;
+// After resuming from S3/S4, SFD surface is also need even scaled height smaller than 4160, such as 4154.
+// Lower the MHW_SFC_SFD_BUFF_HEIGHT_BAR from 4160 to 4000 to ensure SFD surface can be allocated for such case.
+static const uint32_t MHW_SFC_SFD_BUFF_HEIGHT_BAR = 4000;
+
+#define NEED_SFD_LINE_BUFFER(_SURFACE_HEIGHT) ((_SURFACE_HEIGHT) > MHW_SFC_SFD_BUFF_HEIGHT_BAR)
+#define SFD_LINE_BUFFER_SIZE(_SURFACE_HEIGHT) (NEED_SFD_LINE_BUFFER(_SURFACE_HEIGHT) ? (uint32_t)ceil((_SURFACE_HEIGHT) * MHW_SFC_CACHELINE_SIZE / 10) : 0)
+
+typedef class MhwSfcInterface MHW_SFC_INTERFACE, *PMHW_SFC_INTERFACE;
+
+typedef enum _SFC_AVS_INPUT_SITING_COEF
+{
+    SFC_AVS_INPUT_SITING_COEF_0_OVER_8 = 0x0,
+    SFC_AVS_INPUT_SITING_COEF_1_OVER_8 = 0x1,
+    SFC_AVS_INPUT_SITING_COEF_2_OVER_8 = 0x2,
+    SFC_AVS_INPUT_SITING_COEF_3_OVER_8 = 0x3,
+    SFC_AVS_INPUT_SITING_COEF_4_OVER_8 = 0x4,
+    SFC_AVS_INPUT_SITING_COEF_5_OVER_8 = 0x5,
+    SFC_AVS_INPUT_SITING_COEF_6_OVER_8 = 0x6,
+    SFC_AVS_INPUT_SITING_COEF_7_OVER_8 = 0x7,
+    SFC_AVS_INPUT_SITING_COEF_8_OVER_8 = 0x8
+} SFC_AVS_INPUT_SITING_COEF, *PSFC_AVS_INPUT_SITING_COEF;
+
+//!
+//! \brief  Structure to hold AVS Luma Filter Coeff, same as SFC_AVS_LUMA_FILTER_COEFF_G9
+//!
+typedef struct _SFC_AVS_LUMA_FILTER_COEFF
+{
+    // DWORD 0
+    union
+    {
+        struct
+        {
+            uint32_t    Table0XFilterCoefficient0   : MHW_BITFIELD_RANGE(0,7);
+            uint32_t    Table0YFilterCoefficient0   : MHW_BITFIELD_RANGE(8,15);
+            uint32_t    Table0XFilterCoefficient1   : MHW_BITFIELD_RANGE(16,23);
+            uint32_t    Table0YFilterCoefficient1   : MHW_BITFIELD_RANGE(24,31);
+        };
+        struct
+        {
+            uint32_t    Value;
+        };
+    } DW0;
+
+    // DWORD 1
+    union
+    {
+        struct
+        {
+            uint32_t    Table0XFilterCoefficient2   : MHW_BITFIELD_RANGE(0,7);
+            uint32_t    Table0YFilterCoefficient2   : MHW_BITFIELD_RANGE(8,15);
+            uint32_t    Table0XFilterCoefficient3   : MHW_BITFIELD_RANGE(16,23);
+            uint32_t    Table0YFilterCoefficient3   : MHW_BITFIELD_RANGE(24,31);
+        };
+        struct
+        {
+            uint32_t    Value;
+        };
+    } DW1;
+
+    // DWORD 2
+    union
+    {
+        struct
+        {
+            uint32_t    Table0XFilterCoefficient4   : MHW_BITFIELD_RANGE(0,7);
+            uint32_t    Table0YFilterCoefficient4   : MHW_BITFIELD_RANGE(8,15);
+            uint32_t    Table0XFilterCoefficient5   : MHW_BITFIELD_RANGE(16,23);
+            uint32_t    Table0YFilterCoefficient5   : MHW_BITFIELD_RANGE(24,31);
+        };
+        struct
+        {
+            uint32_t    Value;
+        };
+    } DW2;
+
+    // DWORD 3
+    union
+    {
+        struct
+        {
+            uint32_t    Table0XFilterCoefficient6   : MHW_BITFIELD_RANGE(0,7);
+            uint32_t    Table0YFilterCoefficient6   : MHW_BITFIELD_RANGE(8,15);
+            uint32_t    Table0XFilterCoefficient7   : MHW_BITFIELD_RANGE(16,23);
+            uint32_t    Table0YFilterCoefficient7   : MHW_BITFIELD_RANGE(24,31);
+        };
+        struct
+        {
+            uint32_t    Value;
+        };
+    } DW3;
+} SFC_AVS_LUMA_FILTER_COEFF, *PSFC_AVS_LUMA_FILTER_COEFF;
+
+//!
+//! \brief  Structure to hold AVS Chroma Filter Coeff, same as SFC_AVS_CHROMA_FILTER_COEFF_G9
+//!
+typedef struct _SFC_AVS_CHROMA_FILTER_COEFF
+{
+    // DWORD 0
+    union
+    {
+        struct
+        {
+            uint32_t    Table1XFilterCoefficient2   : MHW_BITFIELD_RANGE(0,7);
+            uint32_t    Table1YFilterCoefficient2   : MHW_BITFIELD_RANGE(8,15);
+            uint32_t    Table1XFilterCoefficient3   : MHW_BITFIELD_RANGE(16,23);
+            uint32_t    Table1YFilterCoefficient3   : MHW_BITFIELD_RANGE(24,31);
+        };
+        struct
+        {
+            uint32_t    Value;
+        };
+    } DW0;
+
+    // DWORD 1
+    union
+    {
+        struct
+        {
+            uint32_t    Table1XFilterCoefficient4   : MHW_BITFIELD_RANGE(0,7);
+            uint32_t    Table1YFilterCoefficient4   : MHW_BITFIELD_RANGE(8,15);
+            uint32_t    Table1XFilterCoefficient5   : MHW_BITFIELD_RANGE(16,23);
+            uint32_t    Table1YFilterCoefficient5   : MHW_BITFIELD_RANGE(24,31);
+        };
+        struct
+        {
+            uint32_t    Value;
+        };
+    } DW1;
+} SFC_AVS_CHROMA_FILTER_COEFF, *PSFC_AVS_CHROMA_FILTER_COEFF;
+
+//!
+//! \brief  Structure to hold AVS Luma Coeff tables
+//!
+typedef struct _MHW_SFC_AVS_LUMA_TABLE
+{
+    uint8_t                      sfcPipeMode;                           //!< SFC Pipe Mode
+    SFC_AVS_LUMA_FILTER_COEFF    LumaTable[NUM_HW_POLYPHASE_TABLES];
+} MHW_SFC_AVS_LUMA_TABLE, *PMHW_SFC_AVS_LUMA_TABLE;
+
+//!
+//! \brief  Structure to hold AVS Chroma Coeff tables
+//!
+typedef struct _MHW_SFC_AVS_CHROMA_TABLE
+{
+    uint8_t                      sfcPipeMode;                           //!< SFC Pipe Mode
+    SFC_AVS_CHROMA_FILTER_COEFF  ChromaTable[NUM_HW_POLYPHASE_TABLES];
+} MHW_SFC_AVS_CHROMA_TABLE, *PMHW_SFC_AVS_CHROMA_TABLE;
+
+//!
+//! \brief  Structure to hold AVS State
+//!
+typedef struct _MHW_SFC_AVS_STATE
+{
+    uint8_t                         sfcPipeMode;                        //!< SFC Pipe Mode
+    uint32_t                        dwInputHorizontalSiting;
+    uint32_t                        dwInputVerticalSitting;
+    uint32_t                        dwAVSFilterMode;                   // Bilinear, 5x5 or 8x8
+} MHW_SFC_AVS_STATE, *PMHW_SFC_AVS_STATE;
+
+//!
+//! \brief  SFC State Command parameters
+//!
+typedef struct _MHW_SFC_STATE_PARAMS
+{
+    uint8_t                         sfcPipeMode;                                //!< SFC Pipe Mode: VD-to-SFC or VE-to-SFC
+    uint32_t                        dwVDVEInputOrderingMode;
+    uint32_t                        dwInputChromaSubSampling;                   // Chroma subsampling at SFC input
+    float                           fAlphaPixel;                                // Alpha pixel
+    float                           fChromaSubSamplingXSiteOffset;              // Chroma siting X offset
+    float                           fChromaSubSamplingYSiteOffset;              // Chroma siting Y offset
+    uint32_t                        dwChromaDownSamplingMode;                   // Chroma Downsampling Mode
+    uint32_t                        dwChromaDownSamplingVerticalCoef;           // Chomra Downsampling Vertical Coef
+    uint32_t                        dwChromaDownSamplingHorizontalCoef;         // Chomra Downsampling Horizontal Coef
+
+    uint32_t                        dwOutputFrameHeight;                        // Output Frame Height
+    uint32_t                        dwOutputFrameWidth;                         // Output Frame Width
+    MOS_FORMAT                      OutputFrameFormat;                          // Output Frame Format
+    uint32_t                        dwInputFrameHeight;                         // Input Frame Height
+    uint32_t                        dwInputFrameWidth;                          // Input Frame Width
+    MOS_FORMAT                      InputFrameFormat;                           // Input Frame Format
+
+    // Scaling parameters
+    uint32_t                        dwAVSFilterMode;                            // Bilinear, 5x5 or 8x8
+    uint32_t                        dwSourceRegionHeight;                       // Source/Crop region height
+    uint32_t                        dwSourceRegionWidth;                        // Source/Crop region width
+    uint32_t                        dwSourceRegionVerticalOffset;               // Source/Crop region vertical offset
+    uint32_t                        dwSourceRegionHorizontalOffset;             // Source/Crop region horizontal offset
+    uint32_t                        dwScaledRegionHeight;                       // Scaled region height
+    uint32_t                        dwScaledRegionWidth;                        // Scaled region width
+    uint32_t                        dwScaledRegionVerticalOffset;               // Scaled region vertical offset
+    uint32_t                        dwScaledRegionHorizontalOffset;             // Scaled region horizontal offset
+    uint32_t                        dwTargetRectangleStartHorizontalOffset;     // Target rectangle start horizontal offset
+    uint32_t                        dwTargetRectangleEndHorizontalOffset;       // Target rectangle end horizontal offset
+    uint32_t                        dwTargetRectangleStartVerticalOffset;       // Target rectangle start vertical offset
+    uint32_t                        dwTargetRectangleEndVerticalOffset;         // Target rectangle end vertical offset
+    bool                            bRectangleEnabled;                          // Target rectangle enabled
+    float                           fAVSXScalingRatio;                          // X Scaling Ratio
+    float                           fAVSYScalingRatio;                          // Y Scaling Ratio
+    bool                            bBypassXAdaptiveFilter;                     // If true, X direction will use Default Sharpness level to blend
+                                                                                // b/w smooth and sharp filters rather than the calculated value
+    bool                            bBypassYAdaptiveFilter;                     // If true, Y direction will use Default Sharpness level to blend
+                                                                                // b/w smooth and sharp filters rather than the calculated value
+    bool                            bRGBAdaptive;                               // If true, Enable the RGB Adaptive filter
+    // IEF params
+    bool                            bIEFEnable;                                 // IEF Filter enable
+    bool                            bSkinToneTunedIEFEnable;                    // Skin Tone Tuned IEF enable
+    bool                            bAVSChromaUpsamplingEnable;                 // Up sample chroma prior to IEF filter
+    bool                            b8tapChromafiltering;                       // This bit enables 8 tap filtering for Chroma Channels
+
+    // Rotation Params
+    MHW_ROTATION                    RotationMode;                               // Rotation mode -- 0, 90, 180 or 270
+    uint32_t                        dwMirrorType;                               // Mirror Type -- vert/horiz
+    bool                            bMirrorEnable;                              // Mirror mode -- enable/disable
+
+    // ColorFill params
+    bool                            bColorFillEnable;                           // ColorFill enable
+    float                           fColorFillYRPixel;                          // ColorFill Y/R pixel
+    float                           fColorFillUGPixel;                          // ColorFill U/G pixel
+    float                           fColorFillVBPixel;                          // ColorFill V/B pixel
+    float                           fColorFillAPixel;                           // ColorFill A pixel
+
+    // CSC Params
+    bool                            bCSCEnable;                                 // YUV->RGB/YUV->YUV CSC enable
+    bool                            bRGBASwapEnable;                            // R, B Channel Swap enable
+    bool                            bInputColorSpace;                           //0: YUV color space, 1:RGB color space
+
+    // Memory compression Enable Flag
+    bool                            bMMCEnable;                                 // Flag used to decide whether sfc output should be compressed
+    MOS_RESOURCE_MMC_MODE           MMCMode;                                    // Memory compression mode
+
+    // Resources used by SFC
+    PMOS_RESOURCE                   pOsResOutputSurface;                        // Output Frame written by SFC
+    PMOS_RESOURCE                   pOsResAVSLineBuffer;                        // AVS Line buffer used by SFC
+    PMOS_RESOURCE                   pOsResIEFLineBuffer;                        // IEF Line buffer used by SFC
+
+    uint32_t                        dwOutputSurfaceOffset;                      // Output Frame offset (page based offset)
+    uint16_t                        wOutputSurfaceUXOffset;                     // Output Frame offset (page internal U offset for X axis)
+    uint16_t                        wOutputSurfaceUYOffset;                     // Output Frame offset (page internal U offset for Y axis)
+    uint16_t                        wOutputSurfaceVXOffset;                     // Output Frame offset (page internal V offset for X axis)
+    uint16_t                        wOutputSurfaceVYOffset;                     // Output Frame offset (page internal V offset for Y axis)
+
+} MHW_SFC_STATE_PARAMS, *PMHW_SFC_STATE_PARAMS;
+
+//!
+//! \brief  SFC Output Surface Command parameters
+//!
+typedef struct _MHW_SFC_OUT_SURFACE_PARAMS
+{
+    uint32_t                    ChromaSiting;       //!<  Chroma siting
+    MOS_FORMAT                  Format;             //!<  Surface format
+    uint32_t                    dwWidth;            //!<  Surface width
+    uint32_t                    dwHeight;           //!<  Surface height
+    uint32_t                    dwPitch;            //!<  Surface pitch
+    MOS_TILE_TYPE               TileType;           //!<  Tile Type
+    MOS_TILE_MODE_GMM           TileModeGMM;        //!<  Tile Type from GMM Definition
+    bool                        bGMMTileEnabled;    //!<  GMM defined tile mode flag
+    uint32_t                    dwStreamID;         //!<  Surface StreamID
+    uint32_t                    dwSurfaceXOffset;   //!<  Surface X offset
+    uint32_t                    dwSurfaceYOffset;   //!<  Surface Y offset
+    uint32_t                    dwUYoffset;         //!<  Surface Uoffset in Vertical
+    uint32_t                    dwVUoffset;         //!<  Surface Voffset in Vertical, named by Vplane relative to Uplane
+    PMOS_RESOURCE               pOsResource;        //!<  Surface resource
+    bool                        bCompressible;      //!<  Surface can be compressed
+    uint32_t                    dwCompressionFormat;//!< Surface Compression format
+} MHW_SFC_OUT_SURFACE_PARAMS, *PMHW_SFC_OUT_SURFACE_PARAMS;
+
+//!
+//! \brief  SFC Lock Command parameters
+//!
+typedef struct _MHW_SFC_LOCK_PARAMS
+{
+    uint8_t  sfcPipeMode;                                                        //!< SFC Pipe Mode
+    uint32_t dwGaClientId;                                                       // Ga Client Id
+    bool     bOutputToMemory;                                                    // Write Vebox or Vdbox o/p to memory
+} MHW_SFC_LOCK_PARAMS, *PMHW_SFC_LOCK_PARAMS;
+
+//!
+//! \brief  SFC IEF State parameters
+//!
+typedef struct _MHW_SFC_IEF_STATE_PARAMS
+{
+    uint8_t                             sfcPipeMode;                            //!< SFC Pipe Mode
+
+    // IEF params
+    bool                                bSkinDetailFactor;                      // Skin Detail Factor
+    bool                                bVYSTDEnable;                           // Enable STD in VY subspace
+    bool                                bIEFEnable;                             // Enable IEF
+    uint8_t                             StrongEdgeWeight;
+    uint8_t                             RegularWeight;
+    uint8_t                             StrongEdgeThreshold;
+    uint32_t                            dwGainFactor;
+    uint32_t                            dwR5xCoefficient;
+    uint32_t                            dwR5cxCoefficient;
+    uint32_t                            dwR5cCoefficient;
+    uint32_t                            dwR3xCoefficient;
+    uint32_t                            dwR3cCoefficient;
+
+    // CSC params
+    bool                                bCSCEnable;                             // Enable CSC transform
+    float                               *pfCscCoeff;                             // [3x3] CSC Coeff matrix
+    float                               *pfCscInOffset;                          // [3x1] CSC Input Offset matrix
+    float                               *pfCscOutOffset;                         // [3x1] CSC Output Offset matrix
+} MHW_SFC_IEF_STATE_PARAMS, *PMHW_SFC_IEF_STATE_PARAMS;
+
+class MhwSfcInterface
+{
+public:
+    virtual ~MhwSfcInterface()
+    {
+    }
+
+    //!
+    //! \brief    Adds a resource to the command buffer or indirect state (SSH)
+    //! \details  Internal MHW function to add either a graphics address of a resource or
+    //!           add the resource to the patch list for the requested buffer or state
+    //! \param    [in] pOsInterface
+    //!           OS interface
+    //! \param    [in] pCmdBuffer
+    //!           If adding a resource to the command buffer, the buffer to which the resource
+    //!           is added
+    //! \param    [in] pParams
+    //!           Parameters necessary to add the graphics address
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS(*pfnAddResourceToCmd) (
+        PMOS_INTERFACE                 pOsInterface,
+        PMOS_COMMAND_BUFFER            pCmdBuffer,
+        PMHW_RESOURCE_PARAMS           pParams);
+
+    //!
+    //! \brief      Add SFC Lock
+    //! \param      [in] pCmdBuffer
+    //!             Pointer to Command buffer
+    //! \param      [in] pSfcLockParams
+    //!              Pointer to SFC_LOCK params
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddSfcLock (
+        PMOS_COMMAND_BUFFER            pCmdBuffer,
+        PMHW_SFC_LOCK_PARAMS           pSfcLockParams) = 0;
+
+    //!
+    //! \brief    Add SFC State
+    //! \param    [in] pCmdBuffer
+    //!           Pointer to Command Buffer
+    //! \param    [in] pSfcStateParams
+    //!           Pointer to SFC_STATE params
+    //! \param    [in] pOutSurface
+    //!           Pointer to Output surface params
+    //! \return   MOS_STATUS
+    //!
+    virtual MOS_STATUS AddSfcState(
+        PMOS_COMMAND_BUFFER            pCmdBuffer,
+        PMHW_SFC_STATE_PARAMS          pSfcStateParams,
+        PMHW_SFC_OUT_SURFACE_PARAMS    pOutSurface) = 0;
+
+    //!
+    //! \brief      Add SFC AVS State command
+    //! \param      [in] pCmdBuffer
+    //!             Pointer to Command Buffer
+    //! \param      [in] pSfcAvsState
+    //!             Pointer to SFC AVS State
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddSfcAvsState(
+        PMOS_COMMAND_BUFFER            pCmdBuffer,
+        PMHW_SFC_AVS_STATE             pSfcAvsState) = 0;
+
+    //!
+    //! \brief      Add SFC Frame Start command
+    //! \param      [in] pCmdBuffer
+    //!             Pointer to Command Buffer
+    //! \param      [in] sfcPipeMode
+    //!             SFC pipe mode
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddSfcFrameStart (
+        PMOS_COMMAND_BUFFER            pCmdBuffer,
+        uint8_t                        sfcPipeMode) = 0;
+
+    //!
+    //! \brief      Add SFC IEF State command
+    //! \param      [in] pCmdBuffer
+    //!             Pointer to Command Buffer
+    //! \param      [in] pSfcIefStateParams
+    //!             Pointer to IEF State params
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddSfcIefState(
+        PMOS_COMMAND_BUFFER            pCmdBuffer,
+        PMHW_SFC_IEF_STATE_PARAMS      pSfcIefStateParams) = 0;
+
+    //!
+    //! \brief      Add SFC AVS Chroma Table command
+    //! \param      [in] pCmdBuffer
+    //!             Pointer to Command Buffer
+    //! \param      [in] pChromaTable
+    //!             Pointer to Chroma Coefficient table
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddSfcAvsChromaTable (
+        PMOS_COMMAND_BUFFER            pCmdBuffer,
+        PMHW_SFC_AVS_CHROMA_TABLE      pChromaTable) = 0;
+
+    //!
+    //! \brief      Add SFC AVS Chroma Table command
+    //! \param      [in] pCmdBuffer
+    //!             Pointer to Command Buffer
+    //! \param      [in] pChromaTable
+    //!             Pointer to Chroma Coefficient table
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddSfcAvsLumaTable (
+        PMOS_COMMAND_BUFFER            pCmdBuffer,
+        PMHW_SFC_AVS_LUMA_TABLE        pLumaTable) = 0;
+
+    //!
+    //! \brief      Set Sfc Sampler8x8 Table
+    //! \details    Set Sfc AVS Luma and Chroma table
+    //! \param      [out] pLumaTable
+    //!             Pointer to AVS luma table
+    //! \param      [out] pChromaTable
+    //!             Pointer to AVS chroma table
+    //! \param      [in] pAvsParams
+    //!             Pointer to AVS params
+    //! \param      [in] SrcFormat
+    //!             Input Source Format
+    //! \param      [in] fScaleX
+    //!             Scaling ratio in width
+    //! \param      [in] fScaleY
+    //!             Scaling ratio in height
+    //! \param      [in] dwChromaSiting
+    //!             Chroma Siting info
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS SetSfcSamplerTable (
+        PMHW_SFC_AVS_LUMA_TABLE         pLumaTable,
+        PMHW_SFC_AVS_CHROMA_TABLE       pChromaTable,
+        PMHW_AVS_PARAMS                 pAvsParams,
+        MOS_FORMAT                      SrcFormat,
+        float                           fScaleX,
+        float                           fScaleY,
+        uint32_t                        dwChromaSiting,
+        bool                            bUse8x8Filter,
+        float                           fHPStrength,
+        float                           fLanczosT);
+
+    //!
+    //! \brief      Sets AVS Scaling Mode. Will configure the different coefficients of 8-Tap polyphase filter according to scaling mode.
+    //! \param      [in] ScalingMode
+    //!             AVS scaling mode e.g. Nearest, 8-Tap polyphase etc.
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS SetSfcAVSScalingMode(
+        MHW_SCALING_MODE  ScalingMode)
+    {
+        m_scalingMode = ScalingMode;
+        return MOS_STATUS_SUCCESS;
+    }
+
+    virtual MOS_STATUS GetInputFrameWidthHeightAlignUnit(uint32_t &widthAlignUnit, uint32_t &heightAlignUnit,
+        bool bVdbox, CODECHAL_STANDARD codecStandard, CodecDecodeJpegChromaType jpegChromaType);
+
+    //!
+    //! \brief    Set Sfc Index
+    //! \details  Set Sfc Index
+    //! \param    [in] dwSfcIndex
+    //!           set Sfc Index
+    //! \param    [in] dwSfcCount
+    //!           set Sfc Count
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    virtual MOS_STATUS SetSfcIndex(
+        uint32_t dwSfcIndex,
+        uint32_t dwSfcCount)
+    {
+        MOS_UNUSED(dwSfcIndex);
+        MOS_UNUSED(dwSfcCount);
+        return MOS_STATUS_SUCCESS;
+    }
+
+    //!
+    //! \brief    Get new sfc interface, temporal solution before switching from
+    //!           old interface to new one
+    //!
+    //! \return   pointer to new render interface
+    //!
+    virtual std::shared_ptr<void> GetNewSfcInterface() { return nullptr; }
+
+protected:
+
+    MhwSfcInterface(PMOS_INTERFACE pOsInterface);
+
+    //!
+    //! \brief      Sets AVS Luma Coefficient table
+    //! \param      [in] SrcFormat
+    //!             Source format
+    //! \param      [in] pCoeffTable
+    //!             Pointer to coefficient table
+    //! \param      [in] piYCoefsX
+    //!             Pointer to Y coefficients X
+    //! \param      [in] piYCoefsY
+    //!             Pointer to Y coefficients Y
+    //! \param      [in] bUse8x8Filter
+    //!             Is 8x8 Filter used
+    //! \return     void
+    //!
+    void SetSfcAVSLumaTable(
+        MOS_FORMAT                      SrcFormat,
+        PSFC_AVS_LUMA_FILTER_COEFF      pCoeffTable,
+        int32_t                         *piYCoefsX,
+        int32_t                         *piYCoefsY,
+        bool                            bUse8x8Filter);
+    //!
+    //! \brief      Sets AVS Chroma Coefficient table
+    //! \param      [in] pUVCoeffTable
+    //!             Pointer to UV coefficient table
+    //! \param      [in] piUVCoefsX
+    //!             Pointer to UV coefficients X
+    //! \param      [in] piUVCoefsY
+    //!             Pointer to UV coefficients Y
+    //! \return     void
+    //!
+    void SetSfcAVSChromaTable(
+        PSFC_AVS_CHROMA_FILTER_COEFF        pUVCoeffTable,
+        int32_t                             *piUVCoefsX,
+        int32_t                             *piUVCoefsY);
+
+public:
+    enum SFC_PIPE_MODE
+    {
+        SFC_PIPE_MODE_VDBOX = 0,
+        SFC_PIPE_MODE_VEBOX = 1
+    };
+
+    enum SfcScalabMode
+    {
+        sfcScalabModeSingle = 0, //!< 0 - single pipe
+        sfcScalabModeLeftCol,    //!< 1 - left most column
+        sfcScalabModeRightCol,   //!< 2 - right most column
+        sfcScalabModeMiddleCol   //!< 3 - middle column
+    };
+
+    enum SfcScalabTileType
+    {
+        sfcScalabRealTile = 0, //!< 0 - real tile
+        sfcScalabVirtualTile   //!< 1 - virtual tile
+    };
+
+public:
+    PMOS_INTERFACE                             m_osInterface       = nullptr;
+
+    uint16_t                                   m_veWidthAlignment  = MHW_SFC_VE_WIDTH_ALIGN;
+    uint16_t                                   m_veHeightAlignment = MHW_SFC_VE_HEIGHT_ALIGN;
+    uint32_t                                   m_maxWidth          = MHW_SFC_MAX_WIDTH;
+    uint32_t                                   m_maxHeight         = MHW_SFC_MAX_HEIGHT;
+    uint32_t                                   m_minWidth          = MHW_SFC_MIN_WIDTH;
+    uint32_t                                   m_minHeight         = MHW_SFC_MIN_HEIGHT;
+
+    float                                      m_maxScalingRatio   = MHW_SFC_MAX_SCALINGFACTOR;
+    float                                      m_minScalingRatio   = MHW_SFC_MIN_SCALINGFACTOR;
+
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS           m_outputSurfCtrl;          // Output Frame caching control bits
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS           m_avsLineBufferCtrl;       // AVS Line Buffer caching control bits
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS           m_iefLineBufferCtrl;       // IEF Line Buffer caching control bits
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS           m_sfdLineBufferCtrl;       // SFD Line Buffer caching control bits
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS           m_avsLineTileBufferCtrl;   // AVS Line Tile Buffer caching control bits
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS           m_iefLineTileBufferCtrl;   // IEF Line Tile Buffer caching control bits
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS           m_sfdLineTileBufferCtrl;   // SFD Line Tile Buffer caching control bits
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS           m_histogramBufferCtrl;     // Histogram Buffer caching control bits
+
+    MHW_SCALING_MODE                           m_scalingMode;
+    std::shared_ptr<void>                      m_sfcItfNew = nullptr;
+};
+
+#endif // __MHW_SFC_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_state_heap.h 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_state_heap.h
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_state_heap.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_state_heap.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,1606 @@
+/*
+* Copyright (c) 2014-2020, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file      mhw_state_heap.h 
+//! \brief         This modules implements HW interface layer to be used on all platforms on     all operating systems/DDIs, across MHW components. 
+//!
+#ifndef __MHW_STATE_HEAP_H__
+#define __MHW_STATE_HEAP_H__
+
+#include "mos_os.h"
+#include "mhw_utilities.h"
+#include "heap_manager.h"
+
+typedef struct _MHW_STATE_HEAP_MEMORY_BLOCK MHW_STATE_HEAP_MEMORY_BLOCK, *PMHW_STATE_HEAP_MEMORY_BLOCK;
+typedef struct _MHW_STATE_HEAP_INTERFACE MHW_STATE_HEAP_INTERFACE, *PMHW_STATE_HEAP_INTERFACE;
+typedef class XMHW_STATE_HEAP_INTERFACE *PXMHW_STATE_HEAP_INTERFACE;
+typedef struct _MHW_STATE_HEAP MHW_STATE_HEAP, *PMHW_STATE_HEAP;
+typedef struct MHW_BLOCK_MANAGER *PMHW_BLOCK_MANAGER;
+
+#define MHW_INDIRECT_HEAP_SIZE      MHW_PAGE_SIZE
+#define MHW_SURFACE_PITCH_ALIGNMENT 128
+#define MHW_MAX_SURFACE_PLANES      3
+
+#define MHW_NUM_HW_POLYPHASE_TABLES             17
+#define MHW_NUM_HW_POLYPHASE_EXTRA_TABLES_G9    15
+
+//!
+//! \brief  GSH Defaults and limits
+//!
+#define MHW_MEDIA_STATE_ALIGN          128
+#define MHW_SCRATCH_SPACE_ALIGN        1024
+#define MHW_SAMPLER_STATE_ALIGN        64
+#define MHW_SAMPLER_STATE_VA_ALIGN     32
+#define MHW_SAMPLER_STATE_AVS_ALIGN    1024
+#define MHW_SAMPLER_STATE_AVS_ALIGN_G9 2048
+
+#define MHW_SAMPLER_STATE_AVS_ALIGN_MEDIA  1024 // per old HWCMD files AVS samplers were aligned to 256. Not sure if this is needed
+#define MHW_SURFACE_STATE_ALIGN 64 // (1 << MHW_BINDING_TABLE_OFFSET_SHIFT)
+
+// Each increment in sampler index represents this increment in offset
+#define MHW_SAMPLER_STATE_VA_INC            32
+#define MHW_SAMPLER_STATE_CONV_1D_INC       128
+#define MHW_AVS_SAMPLER_WIDTH_ALIGN_UNIT    2
+#define MHW_SAMPLER_STATE_AVS_INC_LEGACY    512
+#define MHW_AVS_SAMPLER_HEIGHT_ALIGN_UNIT   2
+#define MHW_SAMPLER_STATE_CONV_INC_LEGACY   512
+
+#define MHW_INVALID_BINDING_TABLE_IDX 0xFFFFFFFF
+
+#define MHW_ASSERT_INVALID_BINDING_TABLE_IDX(index)                         \
+{                                                                           \
+    if ((index) == MHW_INVALID_BINDING_TABLE_IDX)                           \
+    {                                                                       \
+        MHW_ASSERTMESSAGE("Invalid (nullptr) Pointer.");                    \
+        eStatus = MOS_STATUS_UNKNOWN;                                       \
+        return eStatus;                                                     \
+    }                                                                       \
+}
+
+#define MHW_INVALID_SYNC_TAG            0xFFFFFFFF
+
+enum MW_RENDER_ENGINE_ADDRESS_SHIFT
+{
+    MHW_STATE_HEAP_SURFACE_STATE_SHIFT = 0
+};
+
+typedef enum _MHW_STATE_HEAP_PARAM_SHIFTS
+{
+    MHW_SLM_SHIFT                   = 2,
+    MHW_BINDING_TABLE_OFFSET_SHIFT  = 6,
+    MHW_BINDING_TABLE_ID_SHIFT      = 5,
+    MHW_SAMPLER_SHIFT               = 5,
+    MHW_CURBE_SHIFT                 = 5,
+    MHW_THRD_CON_DATA_RD_SHIFT      = 5,
+    MHW_KERNEL_OFFSET_SHIFT         = 6,
+    MHW_SAMPLER_INDIRECT_SHIFT      = 6,
+    MHW_SCRATCH_SPACE_SHIFT         = 10,
+    MHW_SSH_BASE_SHIFT              = 12,
+    MHW_COMPUTE_INDIRECT_SHIFT      = 6
+} MHW_STATE_HEAP_PARAM_SHIFTS;
+
+typedef enum _MHW_FRAME_FIELD_TYPE
+{
+    MHW_FRAME = 0,
+    MHW_TOP_FIELD,
+    MHW_BOTTOM_FIELD,
+    MHW_NUM_FRAME_FIELD_TYPES,
+} MHW_FRAME_FIELD_TYPE;
+
+typedef enum _MHW_STATE_HEAP_TYPE
+{
+    MHW_ISH_TYPE = 0,
+    MHW_DSH_TYPE,
+    MHW_SSH_TYPE      //!< Note SSH is currently managed by MOS
+} MHW_STATE_HEAP_TYPE;
+
+typedef enum _MHW_STATE_HEAP_MODE
+{
+    MHW_RENDER_HAL_MODE = 0,     //!< 0 - RenderHal handles
+    MHW_DSH_MODE,                //!< 1 - MDF dynamic heap management
+    MHW_DGSH_MODE                //!< 2 - Ddynamic generic heap management 
+}MHW_STATE_HEAP_MODE;
+
+typedef enum _MHW_PLANE
+{
+    MHW_GENERIC_PLANE = 0,  // 1D Surface: MHW_GENERIC_PLANE, 2D Surface: MHW_Y_PLANE
+    MHW_Y_PLANE = 0,
+    MHW_U_PLANE,
+    MHW_V_PLANE,
+} MHW_PLANE;
+
+//!
+//! \brief MHW Rotation Mode enum
+//!
+typedef enum _MHW_ROTATION
+{
+    MHW_ROTATION_IDENTITY = 0,      //!< Rotation 0 degrees
+    MHW_ROTATION_90,                //!< Rotation 90 degrees
+    MHW_ROTATION_180,               //!< Rotation 180 degrees
+    MHW_ROTATION_270,               //!< Rotation 270 degrees
+    MHW_MIRROR_HORIZONTAL,          //!< Horizontal Mirror
+    MHW_MIRROR_VERTICAL,            //!< Vertical Mirror
+    MHW_ROTATE_90_MIRROR_VERTICAL,  //!< 90 + V Mirror
+    MHW_ROTATE_90_MIRROR_HORIZONTAL //!< 90 + H Mirror
+} MHW_ROTATION;
+
+//!
+//! \brief Render chroma siting vertical value
+//!
+typedef enum _MHW_CHROMA_SITING_VDIRECTION
+{
+    MHW_CHROMA_SITING_VDIRECTION_0   = 0x0,
+    MHW_CHROMA_SITING_VDIRECTION_1_4 = 0x1,
+    MHW_CHROMA_SITING_VDIRECTION_1_2 = 0x2,
+    MHW_CHROMA_SITING_VDIRECTION_3_4 = 0x3,
+    MHW_CHROMA_SITING_VDIRECTION_1   = 0x4
+} MHW_CHROMA_SITING_VDIRECTION;
+
+//!
+//! \brief Chroma Siting enum
+//!
+typedef enum _MHW_CHROMA_SITING
+{
+    MHW_CHROMA_SITING_NONE          = 0,
+    MHW_CHROMA_SITING_HORZ_LEFT     = 1 << 0,
+    MHW_CHROMA_SITING_HORZ_CENTER   = 1 << 1,
+    MHW_CHROMA_SITING_HORZ_RIGHT    = 1 << 2,
+    MHW_CHROMA_SITING_VERT_TOP      = 1 << 4,
+    MHW_CHROMA_SITING_VERT_CENTER   = 1 << 5,
+    MHW_CHROMA_SITING_VERT_BOTTOM   = 1 << 6,
+} MHW_CHROMA_SITING;
+
+//!
+//! \brief Scaling mode enum
+//!
+typedef enum _MHW_SCALING_MODE
+{
+    MHW_SCALING_NEAREST = 0,
+    MHW_SCALING_BILINEAR,
+    MHW_SCALING_AVS
+} MHW_SCALING_MODE;
+
+//!
+//! \brief  AVS Params
+//!
+typedef struct _MHW_AVS_PARAMS
+{
+    MOS_FORMAT              Format;
+    float                   fScaleX;
+    float                   fScaleY;
+    int32_t                 *piYCoefsX;
+    int32_t                 *piYCoefsY;
+    int32_t                 *piUVCoefsX;
+    int32_t                 *piUVCoefsY;
+    bool                    bForcePolyPhaseCoefs;
+    bool                    bUse8x8Filter;
+} MHW_AVS_PARAMS, *PMHW_AVS_PARAMS;
+
+// Memory block state
+typedef enum _MHW_BLOCK_STATE
+{
+    MHW_BLOCK_STATE_POOL = 0,       //!< Block belongs to the pool of memory block objects, it doesn't point to a valid memory block, most fields may be invalid.
+    MHW_BLOCK_STATE_FREE,           //!< Block points to available memory in State Heap
+    MHW_BLOCK_STATE_ALLOCATED,      //!< Block points to allocated area in State Heap (allocated but not in use by GPU)
+    MHW_BLOCK_STATE_SUBMITTED,      //!< Block points to area in State Heap that was submitted for execution by GPU; memory cannot be overwritten or deleted before workload is finished.
+    MHW_BLOCK_STATE_DELETED,        //!< Block is marked for deletion (State Heap is being deleted).
+
+    MHW_BLOCK_STATE_COUNT = 5
+} MHW_BLOCK_STATE;
+
+struct _MHW_STATE_HEAP_MEMORY_BLOCK
+{
+    //!
+    //! \brief The sync tag ID for the memory block may be used to determine
+    //!        whether or not the memory block is in use--if the ID is
+    //!        invalid (+1 to the defined maximum number of sync tags), the
+    //!        memory block is not in use and some or all of it may be used
+    //!        for a new kernel state region.
+    //!
+    FrameTrackerTokenFlat trackerToken;
+
+    uint32_t            dwBlockSize;
+    PMHW_STATE_HEAP     pStateHeap;
+    uint32_t            dwOffsetInStateHeap;
+    bool                bStatic;      //!< The kernel state region in this state heap is static and will not be removed during cleanup step.
+
+    _MHW_STATE_HEAP_MEMORY_BLOCK    *pPrev;
+    _MHW_STATE_HEAP_MEMORY_BLOCK    *pNext;
+
+    //!
+    //! \brief The following code is for the MHW dynamic state heap implementation by MDF. 
+    //!        Code is not yet unified across all media driver components
+    //!
+    MHW_BLOCK_STATE                 BlockState: 16;   //!< Current block state (void, free, allocated, in use, completed, deleted)
+    uint32_t                        bDelete   :  1;   //!< Block is flagged for deletion upon completion
+    uint32_t                        Reserved  : 15;   //!< Reserved (uniq block ID used for tracking block utilization by system)
+
+    PMHW_STATE_HEAP_MEMORY_BLOCK    pHeapNext;        //!< Next block in same state heap (adjacent), null if last
+    PMHW_STATE_HEAP_MEMORY_BLOCK    pHeapPrev;        //!< Previous block in same state heap (adjacent), null if first
+
+    uint8_t                         *pDataPtr;         //!< Pointer to aligned data
+    uint32_t                        dwDataOffset;     //!< Offset of pDataPtr (from State Heap Base - used in state programming)
+    uint32_t                        dwDataSize;       //!< Data size (>= requested size due to heap granularity)
+    uint32_t                        dwAlignment;      //!< Offset alignment (offset from actual block start)
+};
+
+typedef struct _MHW_KERNEL_PARAM
+{
+    void    *pExtra;                         //!< Kernel parameter
+    uint8_t *pBinary;                        //!< Pointer to kernel binary
+    int32_t iSize;                          //!< Kernel size
+    int32_t iGrfCount;                      //!< Number of registers
+    int32_t iBTCount;                       //!< Number of BT entries
+    int32_t iThreadCount;                   //!< Number of threads (max)
+    int32_t iGrfStartRegister;              //!< Start register
+    int32_t iSamplerCount;                  //!< Sampler count
+    int32_t iSamplerLength;                 //!< Sampler length
+    int32_t iCurbeLength;                   //!< Constant URB length
+    int32_t iIdCount;                       //!< Num IDs used by kernel state
+    int32_t iInlineDataLength;              //!< MEDIA_OBJECT inline data (aka URB length)
+    int32_t iBlockWidth;                    //!< Block width
+    int32_t iBlockHeight;                   //!< Block height
+
+    //!
+    //! \brief Dynamic kernel parameters may follow below if necessary.
+    //!
+    int32_t bLoaded;                        //!< Kernel Loaded flag
+    int32_t iKID;                           //!< Interface descriptor ID for the kernel
+    int32_t iKUID;                          //!< Kernel Unique ID
+    int32_t iKCID;                          //!< Kernel Cache ID
+    int32_t iAKBaseID;                      //!< Authenticated Kernel Base ID
+
+    bool    bForceReload;                   //!< The flag to indicate if the kernel need to be reloaded forcibly
+
+} MHW_KERNEL_PARAM, *PMHW_KERNEL_PARAM;
+
+typedef struct MHW_KERNEL_STATE
+{
+    MHW_KERNEL_STATE()
+    {
+        m_dshRegion = MemoryBlock();
+        m_ishRegion = MemoryBlock();
+    }
+
+    virtual ~MHW_KERNEL_STATE() { MHW_FUNCTION_ENTER;  }
+    //!
+    //! \brief Set when the kernel state is created
+    //!
+    MHW_KERNEL_PARAM    KernelParams = {};   //!< Kernel parameters
+
+    //!
+    //! \brief Set when the kernel state region for the kernel state
+    //!        is acquired.
+    //!        Note: For state heaps other than the SSH it is possible to
+    //!              make a kernel state region static, such that it belongs
+    //!              to the kernel state and it is not necessary to acquire a
+    //!              kernel state region for the DSH/ISH (whichever is
+    //!              static).
+    //!
+    uint32_t dwSshOffset = 0;            //!< Offset within SSH to the kernel state region
+    uint32_t dwBindingTableSize = 0;     //!< The size of the binding table for this kernel state
+    uint32_t dwSshSize = 0;              //!< Size of the kernel state region in the SSH
+    uint32_t dwIdOffset = 0;             //!< Offset within DSH to ID(s) in kernel state region
+    uint32_t dwCurbeOffset = 0;          //!< Offset within DSH to CURBE(s) in kernel state region
+    uint32_t dwSamplerOffset = 0;        //!< Offset within DSH to Sampler(s) in kernel state region
+    uint32_t dwKernelBinaryOffset = 0;   //!< Offset within ISH to the kernel state region
+
+    //!
+    //! \brief Descriptors of the DSH/ISH kernel state regions. Since there
+    //!        may be multiple DSH/ISH buffers, it is necessary to store
+    //!        which one is used. If one of the regions is static, the memory
+    //!        block pointer is always expected to be valid.
+    //!
+    MemoryBlock m_dshRegion;
+    MemoryBlock m_ishRegion;
+
+    uint32_t    m_currTrackerId = MemoryBlock::m_invalidTrackerId;  //!< tracker ID for the current execution
+} *PMHW_KERNEL_STATE;
+
+typedef struct _MHW_BINDING_TABLE_PARAMS {
+    uint8_t     *pBindingTableEntry;             // Pointer to BT entry to setup
+    uint32_t    dwSurfaceStateOffset;           // Offset to Surface State (Indirect State)
+    bool        bSurfaceStateAvs;               // true if AVS surface
+    int32_t     iBindingTableEntry;             // Binding Table entry index
+} MHW_BINDING_TABLE_PARAMS, *PMHW_BINDING_TABLE_PARAMS;
+
+typedef struct _MHW_BINDING_TABLE_SEND_PARAMS {
+    uint8_t     *pBindingTableSource;            // Pointer to BT source
+    uint8_t     *pBindingTableTarget;            // Pointer to BT target
+    int32_t     iSurfaceStateBase;              // Offset to first Surface State in SSH
+    int32_t     iSurfaceStateOffset;            // [out] Offset to Surface State in SSH
+    int32_t     iSurfaceState;                  // [out] Surface State index (-1 if Copy==0)
+} MHW_BINDING_TABLE_SEND_PARAMS, *PMHW_BINDING_TABLE_SEND_PARAMS;
+
+typedef struct _MHW_SURFACE_STATE_PARAMS {
+    uint8_t     *pSurfaceState;
+    uint32_t    dwCacheabilityControl;
+    uint32_t    dwFormat;
+    uint32_t    dwWidth;
+    uint32_t    dwHeight;
+    uint32_t    dwDepth;
+    uint32_t    dwPitch;
+    uint32_t    dwQPitch;
+    uint32_t    bUseAdvState              : 1;
+    uint32_t    AddressControl            : 1;
+    uint32_t    SurfaceType3D             : 3;
+    uint32_t    bTiledSurface             : 1;
+    uint32_t    bTileWalk                 : 1;
+    uint32_t    bVerticalLineStride       : 1;
+    uint32_t    bVerticalLineStrideOffset : 1;
+    uint32_t    bCompressionEnabled       : 1;
+    uint32_t    bCompressionMode          : 1;
+    uint32_t    MmcState                  : 3;
+    uint32_t    bInterleaveChroma         : 1;
+    uint32_t    bHalfPitchChroma          : 1;
+    uint32_t    bSeperateUVPlane          : 1;
+    uint32_t    UVPixelOffsetUDirection   : 2;
+    uint32_t    UVPixelOffsetVDirection   : 2;
+    uint32_t    RotationMode              : 3;
+    uint32_t    bSurfaceArraySpacing      : 1;
+    uint32_t    bBoardColorOGL            : 1;
+    int32_t     iXOffset;
+    int32_t     iYOffset;
+    uint32_t    dwXOffsetForU; // U or UV
+    uint32_t    dwYOffsetForU; // U or UV
+    uint32_t    dwXOffsetForV;
+    uint32_t    dwYOffsetForV;
+    uint32_t    dwCompressionFormat;    // Memory Compression Format
+    uint32_t    L1CacheConfig;
+
+    uint32_t    *pdwCmd;                // [out] Pointer for patching
+    uint32_t    dwLocationInCmd;       // [out] Offset in command for patching
+    MOS_TILE_MODE_GMM TileModeGMM;     // Tile Type from GMM Definition
+    bool        bGMMTileEnabled;       //!<  GMM defined tile mode flag
+} MHW_SURFACE_STATE_PARAMS, *PMHW_SURFACE_STATE_PARAMS;
+
+struct _MHW_STATE_HEAP
+{
+    MOS_RESOURCE    resHeap;        //!< Graphics resource for state heap
+    void            *pvLockedHeap;   //!< System (logical) address for state heap
+    bool            bKeepLocked;
+    uint32_t        dwSize;         //!< Size of the state heap
+
+    uint32_t        dwUsed;         //!< Used memory in state heap
+    uint32_t        dwFree;         //!< Free memory in state heap
+    bool            bDeleted;       //!< State heap is in process of being deleted
+
+    // State heap object points to its interface object and block manager
+    PMHW_BLOCK_MANAGER pBlockManager;
+    PXMHW_STATE_HEAP_INTERFACE pMhwStateHeapInterface;
+
+    //!
+    //! \brief The memory blocks will be managed in a linked list, each state
+    //!        heap will have one linked list starting with pMemoryHead. The
+    //!        memory blocks in this list will describe all available and 
+    //!        used space in the state heap.
+    //!
+    PMHW_STATE_HEAP_MEMORY_BLOCK    pMemoryHead;
+
+    PMHW_STATE_HEAP_MEMORY_BLOCK    pMemoryTail;    //!< Last block in state heap memory (used to traverse pMemNext/pMemPrev)
+    PMHW_STATE_HEAP_MEMORY_BLOCK    pDebugKernel;   //!< Block associated to debug (SIP) kernel in the current ISH
+    PMHW_STATE_HEAP_MEMORY_BLOCK    pScratchSpace;  //!< Block associated with current active scratch space (older scratch spaces are removed)
+    uint32_t                        dwScratchSpace; //!< Active scratch space size
+
+    PMHW_STATE_HEAP  pPrev;         //!< The first state heap is considered primary (pPrev == nullptr)
+    PMHW_STATE_HEAP  pNext;
+
+    uint32_t         dwCurrOffset;   //!< For simulated SSH to denote the current amount of space used
+};
+
+typedef struct _MHW_SYNC_TAG
+{
+    uint32_t dwCmdBufId;             //!< Command buffer ID for this sync tag, 0 is available
+    uint32_t dwSshSizeUsed;
+
+    //!
+    //! \brief Memory blocks used during the clean up step.
+    //!
+    PMHW_STATE_HEAP_MEMORY_BLOCK pDshRegion; //!< Memory block for DSH
+    PMHW_STATE_HEAP_MEMORY_BLOCK pIshRegion; //!< Memory block for ISH
+} MHW_SYNC_TAG, *PMHW_SYNC_TAG;
+
+typedef struct _MHW_INTERFACE_DESCRIPTOR_PARAMS
+{
+    PMHW_KERNEL_STATE   pKernelState;
+    uint32_t            dwKernelStartOffset; //!< Offset relative to the kernel state region binary start offset in the ISH
+    uint32_t            dwIdIdx;             //!< Index within the ID block of the kernel state region in the DSH of the ID to be added
+    uint32_t            dwBtOffset;          //!< Offset relative to SSH base of the BT start
+    uint32_t            dwSamplerOffset;     //!< Offset within the Sampler block of the kernel state region for the current sampler state
+} MHW_INTERFACE_DESCRIPTOR_PARAMS, *PMHW_INTERFACE_DESCRIPTOR_PARAMS;
+
+// Structure used to program media interface descriptor entry
+typedef struct _MHW_ID_ENTRY_PARAMS
+{
+    uint32_t            dwMediaIdOffset;                //! Offset of the first Media Interface Descriptor (in DSH)
+    uint32_t            iMediaId;                       //! Media Interface Descriptor #
+    uint32_t            dwKernelOffset;                 //! Kernel offset (in ISH)
+    uint32_t            dwSamplerOffset;                //! Sampler offset (in DSH)
+    uint32_t            dwSamplerCount;                 //! Sample count
+    uint32_t            dwBindingTableOffset;           //! Binding table offset (in DSH)
+    uint32_t            iCurbeOffset;                   //! Curbe offset (in DSH)
+    uint32_t            iCurbeLength;                   //! Curbe lenght
+    bool                bBarrierEnable;                 //! Enable Barrier
+    bool                bGlobalBarrierEnable;           //! Enable Global Barrier (SKL+)
+    uint32_t            dwNumberofThreadsInGPGPUGroup;  //! Number of threads per group
+    uint32_t            dwSharedLocalMemorySize;        //! Size of SharedLocalMemory (SLM)
+    int32_t             iCrsThdConDataRdLn;             //!
+    PMHW_STATE_HEAP     pGeneralStateHeap;              //! General state heap in use
+    MemoryBlock         *memoryBlock;                   //! Memory block associated with the state heap
+} MHW_ID_ENTRY_PARAMS, *PMHW_ID_ENTRY_PARAMS;
+
+typedef struct _MHW_PLANE_SETTING
+{
+    uint8_t ui8PlaneID;                                                            // Plane identifier
+    uint8_t ui8ScaleWidth;                                                         // X Scale (divider)
+    uint8_t ui8ScaleHeight;                                                        // Y Scale (divider)
+    uint8_t ui8AlignWidth;                                                         // X Alignment
+    uint8_t ui8AlignHeight;                                                        // Y Alignment
+    uint8_t ui8PixelsPerDword;                                                     // Pixels per Dword (for dataport read/write)
+    bool    bAdvanced;                                                             // Advanced Surface State
+    uint32_t dwFormat;                                                              // Hardware Surface Format
+} MHW_PLANE_SETTING, *PMHW_PLANE_SETTING;
+
+typedef struct _MHW_SURFACE_PLANES
+{
+    uint32_t            dwNumPlanes;                                              // Number of planes
+    MHW_PLANE_SETTING   Plane[MHW_MAX_SURFACE_PLANES];                            // Description of each plane
+} MHW_SURFACE_PLANES, *PMHW_SURFACE_PLANES;
+
+typedef const _MHW_PLANE_SETTING  *PCMHW_PLANE_SETTING;
+typedef const _MHW_SURFACE_PLANES *PCMHW_SURFACE_PLANES;
+
+typedef struct _MHW_RCS_SURFACE_PARAMS
+{
+    PMOS_SURFACE    psSurface;
+
+    uint32_t        bUseAdvState;                     //!< Indicates that SURFACE_STATE_ADV should be used
+
+    uint32_t        dwNumPlanes;                      //!< Indicates the number of valid binding table offsets included
+    uint32_t        dwPlaneType[MHW_MAX_SURFACE_PLANES]; //!< Indicates the plane type
+    uint32_t        dwBindingTableOffset[MHW_MAX_SURFACE_PLANES]; //!< Binding table offset for all planes included in surface
+    uint32_t        dwCacheabilityControl;
+    bool            bRenderTarget;
+    bool            bIsWritable;
+
+    uint32_t        dwWidthToUse[MHW_MAX_SURFACE_PLANES];   //!< If non-zero, overrides value in psSurface
+    uint32_t        dwHeightToUse[MHW_MAX_SURFACE_PLANES];  //!< If non-zero, overrides value in psSurface
+    uint32_t        dwPitchToUse[MHW_MAX_SURFACE_PLANES];   //!< If non-zero, overrides value in psSurface
+    uint32_t        dwBaseAddrOffset[MHW_MAX_SURFACE_PLANES];
+    uint32_t        dwYOffset[MHW_MAX_SURFACE_PLANES];
+    uint32_t        dwXOffset[MHW_MAX_SURFACE_PLANES];
+    uint32_t        ForceSurfaceFormat[MHW_MAX_SURFACE_PLANES]; //!< Of type GFX3DSTATE_SURFACEFORMAT
+    uint32_t        dwSurfaceType; //!< of type GFX3DSTATE_SURFACETYPE
+
+    uint32_t        bVertLineStride;
+    uint32_t        bVertLineStrideOffs;
+    uint32_t        bInterleaveChroma;
+
+    uint32_t                     dwAddressControl;
+    MHW_CHROMA_SITING_VDIRECTION Direction;
+    MHW_ROTATION                 Rotation;                         //!<  0: 0 degree, 1: 90 degree, 2: 180 degree, 3: 270 degree
+    uint32_t                        MediaBoundaryPixelMode;     //!< Of type GFX3DSTATE_MEDIA_BOUNDARY_PIXEL_MODE
+    uint32_t                     dwOffsetInSSH;
+} MHW_RCS_SURFACE_PARAMS, *PMHW_RCS_SURFACE_PARAMS;
+
+typedef struct _MHW_SURFACE_TOKEN_PARAMS
+{
+    PMOS_SURFACE    pOsSurface;
+    uint32_t        dwSurfaceOffset;
+    uint32_t        YUVPlane            : 2;
+    uint32_t        bRenderTarget       : 1;
+    uint32_t                            : 1;
+    uint32_t        bSurfaceTypeAvs     : 1;
+    uint32_t                            : 26;
+} MHW_SURFACE_TOKEN_PARAMS, *PMHW_SURFACE_TOKEN_PARAMS;
+
+//!
+//! \brief Sampler Type
+//!
+typedef enum _MHW_SAMPLER_TYPE
+{
+    MHW_SAMPLER_TYPE_INVALID  = 0,
+    MHW_SAMPLER_NONE          ,
+    MHW_SAMPLER_TYPE_3D       ,   // UNORM
+    MHW_SAMPLER_TYPE_AVS      ,   // AVS (Avanced Video Sampler = 8x8, STE, IEF)
+    MHW_SAMPLER_TYPE_VME      ,   // VME
+    MHW_SAMPLER_TYPE_MISC     ,   // MISC
+    MHW_SAMPLER_TYPE_MINMAX   ,
+    MHW_SAMPLER_TYPE_ERODE    ,
+    MHW_SAMPLER_TYPE_DILATE   ,
+    MHW_SAMPLER_TYPE_CONV         // CONVOLUTION (Gen8+)
+} MHW_SAMPLER_TYPE, *PMHW_SAMPLER_TYPE;
+
+typedef enum _MHW_SAMPLER_ELEMENTS_TYPE : unsigned int
+{
+    MHW_Sampler1Element = 0,
+    MHW_Sampler2Elements,
+    MHW_Sampler4Elements,
+    MHW_Sampler8Elements,
+    MHW_Sampler64Elements,
+    MHW_Sampler128Elements,
+
+    MHW_SamplerTotalElements
+}MHW_SAMPLER_ELEMENT_TYPE, *PMHW_SAMPLER_ELEMENT_TYPE;
+
+//!
+//! \brief Sampler Tap Mode
+//!
+typedef enum _MHW_SAMPLER_TAP_MODE
+{
+    MHW_SAMPLER_FILTER_4_TAP  = 0,
+    MHW_SAMPLER_FILTER_8_4_TAP,
+    MHW_SAMPLER_FILTER_8_TAP,
+    MHW_SAMPLER_FILTER_8_TAP_ADATIVE
+} MHW_SAMPLER_TAP_MODE, *PMHW_SAMPLER_TAP_MODE;
+
+//!
+//! \brief Sampler Filter Mode
+//!
+typedef enum _MHW_SAMPLER_FILTER_MODE
+{
+    MHW_SAMPLER_FILTER_CUSTOM = 0,
+    MHW_SAMPLER_FILTER_NEAREST,
+    MHW_SAMPLER_FILTER_BILINEAR
+} MHW_SAMPLER_FILTER_MODE, *PMHW_SAMPLER_FILTER_MODE;
+
+typedef enum _MHW_SAMPLER_TEXTADDR
+{
+    MHW_SAMPLER_TEXTADDR_WRAP,
+    MHW_SAMPLER_TEXTADDR_MIRROR,
+    MHW_SAMPLER_TEXTADDR_CLAMP,
+    MHW_SAMPLER_TEXTADDR_CUBE,
+    MHW_SAMPLER_TEXTADDR_CLAMPBORDER,
+    MHW_SAMPLER_TEXTADDR_MIRROR_ONCE
+} MHW_SAMPLER_TEXTADDR;
+
+typedef struct _MHW_AVS_COEFFICIENT_PARAM
+{
+    int8_t ZeroXFilterCoefficient[8];
+    int8_t ZeroYFilterCoefficient[8];
+    int8_t OneXFilterCoefficient[4]; //!< [0..3] maps to filter coefficients [2..5], in actual tabel [0..1] are reserved
+    int8_t OneYFilterCoefficient[4]; //!< [0..3] maps to filter coefficients [2..5], in actual tabel [0..1] are reserved
+} MHW_AVS_COEFFICIENT_PARAM, *PMHW_AVS_COEFFICIENT_PARAM;
+
+typedef struct _MHW_SAMPLER_AVS_TABLE_PARAM
+{
+    MHW_AVS_COEFFICIENT_PARAM paMhwAvsCoeffParam[MHW_NUM_HW_POLYPHASE_TABLES];
+
+    // sampler table control
+    uint8_t byteTransitionArea8Pixels; //!< only least 3-bits used
+    uint8_t byteTransitionArea4Pixels; //!< only least 3-bits used
+    uint8_t byteMaxDerivative8Pixels;
+    uint8_t byteMaxDerivative4Pixels;
+    uint8_t byteDefaultSharpnessLevel;
+
+    bool bEnableRGBAdaptive;
+    bool bAdaptiveFilterAllChannels;
+    bool bBypassYAdaptiveFiltering;
+    bool bBypassXAdaptiveFiltering;
+
+    bool b8TapAdaptiveEnable;
+    bool b4TapGY;
+    bool b4TapRBUV;
+
+    bool bIsCoeffExtraEnabled;
+    MHW_AVS_COEFFICIENT_PARAM paMhwAvsCoeffParamExtra[MHW_NUM_HW_POLYPHASE_EXTRA_TABLES_G9]; // only for gen9+
+
+} MHW_SAMPLER_AVS_TABLE_PARAM, *PMHW_SAMPLER_AVS_TABLE_PARAM;
+
+//!
+//! \brief  Sampler States for 8x8 sampler
+//!
+typedef struct _MHW_SAMPLER_STATE_AVS_PARAM
+{
+    int16_t                      stateID;
+
+    // STE params
+    bool                         bEnableSTDE;           // a.k.a SkinToneTunedIEF
+    bool                         b8TapAdaptiveEnable;
+    bool                         bSkinDetailFactor;
+    bool                         bHdcDwEnable;          // Gen9+
+    bool                         bWritebackStandard;    // set Writeback same as Original Sample_8x8
+
+    // IEF params
+    bool                         bEnableIEF;
+    uint16_t                     wIEFFactor;            // 0 will disable IEF
+    uint16_t                     wR3xCoefficient;
+    uint16_t                     wR3cCoefficient;
+    uint16_t                     wR5xCoefficient;
+    uint16_t                     wR5cxCoefficient;
+    uint16_t                     wR5cCoefficient;
+
+    // AVS params
+    bool                         bEnableAVS;
+    bool                         AvsType;          // 0 - Polyphase; 1 - nearest
+    bool                         EightTapAFEnable;
+    bool                         BypassIEF;        // ignored for BWL, moved to sampler8x8 payload.
+    uint16_t                     GainFactor;
+    uint8_t                      GlobalNoiseEstm;
+    uint8_t                      StrongEdgeThr;
+    uint8_t                      WeakEdgeThr;
+    uint8_t                      StrongEdgeWght;
+    uint8_t                      RegularWght;
+    uint8_t                      NonEdgeWght;
+    bool                         b8TapLumaForYUV444;
+
+    // Additional overrides
+    uint16_t AdditionalOverridesUsed;
+    uint16_t YSlope2;
+    uint16_t S0L;
+    uint16_t YSlope1;
+    uint16_t S2U;
+    uint16_t S1U;
+
+    PMHW_SAMPLER_AVS_TABLE_PARAM pMhwSamplerAvsTableParam; // pointer to AVS scaling 8x8 table params
+
+    int32_t                      iTable8x8_Index;   // Table allocation index (not needed on Gen8+)
+    void                         *pTable8x8_Ptr;     // Table data ptr in GSH
+    uint32_t                     dwTable8x8_Offset; // Table data offset in GSH
+} MHW_SAMPLER_STATE_AVS_PARAM, *PMHW_SAMPLER_STATE_AVS_PARAM;
+
+//!
+//! \brief  Structure to handle UNORM sampler states
+//!
+typedef enum _MHW_SAMPLER_SURFACE_PIXEL_TYPE
+{
+    MHW_SAMPLER_SURFACE_PIXEL_UINT,
+    MHW_SAMPLER_SURFACE_PIXEL_SINT,
+    MHW_SAMPLER_SURFACE_PIXEL_OTHER
+} MHW_SAMPLER_SURFACE_PIXEL_TYPE;
+
+typedef enum _MHW_GFX3DSTATE_MAPFILTER
+{
+    MHW_GFX3DSTATE_MAPFILTER_NEAREST        = 0x0,
+    MHW_GFX3DSTATE_MAPFILTER_LINEAR         = 0x1,
+    MHW_GFX3DSTATE_MAPFILTER_ANISOTROPIC    = 0x2,
+    MHW_GFX3DSTATE_MAPFILTER_FLEXIBLE       = 0x3,
+    MHW_GFX3DSTATE_MAPFILTER_MONO           = 0x6
+} MHW_GFX3DSTATE_MAPFILTER;
+
+typedef enum _MHW_GFX3DSTATE_TEXCOORDMODE
+{
+    MHW_GFX3DSTATE_TEXCOORDMODE_WRAP            = 0,
+    MHW_GFX3DSTATE_TEXCOORDMODE_MIRROR          = 1,
+    MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP           = 2,
+    MHW_GFX3DSTATE_TEXCOORDMODE_CUBE            = 3,
+    MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP_BORDER    = 4,
+    MHW_GFX3DSTATE_TEXCOORDMODE_MIRROR_ONCE     = 5
+} MHW_GFX3DSTATE_TEXCOORDMODE;
+
+typedef enum _MHW_CHROMAKEY_MODE
+{
+    MHW_CHROMAKEY_MODE_KILL_ON_ANY_MATCH = 0,
+    MHW_CHROMAKEY_MODE_REPLACE_BLACK = 1
+} MHW_CHROMAKEY_MODE;
+
+typedef struct _MHW_SAMPLER_STATE_UNORM_PARAM
+{
+    MHW_SAMPLER_FILTER_MODE      SamplerFilterMode;
+    MHW_GFX3DSTATE_MAPFILTER     MagFilter;
+    MHW_GFX3DSTATE_MAPFILTER     MinFilter;
+    MHW_GFX3DSTATE_TEXCOORDMODE  AddressU;
+    MHW_GFX3DSTATE_TEXCOORDMODE  AddressV;
+    MHW_GFX3DSTATE_TEXCOORDMODE  AddressW;
+
+    MHW_SAMPLER_SURFACE_PIXEL_TYPE SurfaceFormat;
+    union {
+        uint32_t BorderColorRedU;
+        int32_t BorderColorRedS;
+        float BorderColorRedF;
+    };
+
+    union {
+        uint32_t BorderColorGreenU;
+        int32_t BorderColorGreenS;
+        float BorderColorGreenF;
+    };
+
+    union {
+        uint32_t BorderColorBlueU;
+        int32_t BorderColorBlueS;
+        float BorderColorBlueF;
+    };
+
+    union {
+        uint32_t BorderColorAlphaU;
+        int32_t BorderColorAlphaS;
+        float BorderColorAlphaF;
+    };
+
+    uint32_t IndirectStateOffset;
+    void  *pIndirectState;
+    bool bBorderColorIsValid;
+
+    bool bChromaKeyEnable;
+    uint32_t ChromaKeyIndex;
+    MHW_CHROMAKEY_MODE ChromaKeyMode;
+} MHW_SAMPLER_STATE_UNORM_PARAM, *PMHW_SAMPLER_STATE_UNORM_PARAM;
+
+//!
+//! \brief  Structure to capture sizes of HW engine commands and structures
+//!
+typedef struct _MHW_RENDER_STATE_SIZES
+{
+    uint32_t            dwSizeMediaObjectHeaderCmd;                             // Size of Media Object Header Command
+    uint32_t            dwMaxSizeSurfaceState;                                  // Max size of a surface state
+    uint32_t            dwSizeSurfaceState;                                     // Size of surface state
+    uint32_t            dwSizeSurfaceStateAvs;                                  // Size of AVS surface state
+    uint32_t            dwSizeBindingTableState;                                // Size of binding table state entry
+    uint32_t            dwSizeSamplerState;                                     // Size of sampler state (unorm)
+    uint32_t            dwSizeSamplerIndirectState;                             // Size of sampler indirect state (unorm)
+    uint32_t            dwSizeSamplerStateAvs;                                  // Size of sampler state (Avs)
+    uint32_t            dwSizeSamplerStateVA;                                   // Size of sampler state (va)
+    uint32_t            dwSizeSamplerStateVAConvolve;                           // Size of sampler state (va convolve)
+    uint32_t            dwSizeSamplerStateTable8x8;                             // Size of sampler state 8x8 table
+    uint32_t            dwSizeSampler8x8Table;                                  // Size of sampler 8x8 table
+    uint32_t            dwSizeInterfaceDescriptor;                              // Size of interface descriptor
+    uint32_t            dwSizeMediaWalkerBlock;                                 // Size of Media Walker block
+} MHW_RENDER_STATE_SIZES, *PMHW_RENDER_STATE_SIZES;
+
+//!
+//! \brief  Structure to handle VME Sampler State
+//!
+typedef struct _MHW_SAMPLER_STATE_VME_PARAM
+{
+    uint32_t                     *pdwLUTSearchPath;
+    uint32_t                     *pdwLUTMbMode;
+    uint32_t                     *pdwLUTMv;
+} MHW_SAMPLER_STATE_VME_PARAM, *PMHW_SAMPLER_STATE_VME_PARAM;
+
+typedef struct _MHW_SAMPLER_CONVOLVE_COEFF_TABLE
+{
+    uint16_t wFilterCoeff[16];
+} MHW_SAMPLER_CONVOLVE_COEFF_TABLE;
+
+typedef struct _MHW_SAMPLER_STATE_CONVOLVE_PARAM
+{
+    uint8_t                      ui8ConvolveType;       // 1d, 2d
+    uint8_t                      ui8Height;
+    uint8_t                      ui8Width;
+    uint8_t                      ui8ScaledDownValue;
+    uint8_t                      ui8SizeOfTheCoefficient;
+    uint8_t                      ui8MSBHeight;
+    uint8_t                      ui8MSBWidth;
+    bool                         skl_mode;
+    MHW_SAMPLER_CONVOLVE_COEFF_TABLE CoeffTable[62];
+} MHW_SAMPLER_STATE_CONVOLVE_PARAM, *PMHW_SAMPLER_STATE_CONVOLVE_PARAM;
+
+typedef struct _MHW_SAMPLER_8x8_MISC_STATE {
+    uint8_t byteHeight;
+    uint8_t byteWidth;
+    uint16_t wRow[15];
+} MHW_SAMPLER_8x8_MISC_STATE, *PMHW_SAMPLER_8x8_MISC_STATE;
+
+//!
+//! \brief  Structure to handle Sampler State
+//!
+typedef struct _MHW_SAMPLER_STATE_PARAM
+{
+    bool                        bInUse;
+    PMHW_KERNEL_STATE           pKernelState;
+    MHW_SAMPLER_TYPE            SamplerType;
+    MHW_SAMPLER_ELEMENT_TYPE    ElementType;
+    union
+    {
+        MHW_SAMPLER_STATE_UNORM_PARAM     Unorm;
+        MHW_SAMPLER_STATE_AVS_PARAM       Avs;
+        MHW_SAMPLER_STATE_VME_PARAM       Vme;
+        MHW_SAMPLER_STATE_CONVOLVE_PARAM  Convolve;
+        MHW_SAMPLER_8x8_MISC_STATE        Misc;
+    };
+} MHW_SAMPLER_STATE_PARAM, *PMHW_SAMPLER_STATE_PARAM;
+
+typedef struct _MHW_SURFACE_STATE_SEND_PARAMS {
+    uint8_t                 *pIndirectStateBase;
+    uint8_t                 *pSurfaceStateSource;
+    uint8_t                 *pSurfaceToken;
+    int32_t                 iIndirectStateBase;
+    int32_t                 iSurfaceStateOffset;
+    bool                    bNeedNullPatch;
+} MHW_SURFACE_STATE_SEND_PARAMS, *PMHW_SURFACE_STATE_SEND_PARAMS;
+
+struct MHW_STATE_HEAP_SETTINGS
+{
+    MHW_STATE_HEAP_SETTINGS() {}
+
+    virtual ~MHW_STATE_HEAP_SETTINGS() {}
+
+    uint32_t        dwIshSize = 0;          //!< Initial size of ISH
+    uint32_t        dwDshSize = 0;          //!< Initial size of DSH
+    uint32_t        dwIshIncrement = 0;     //!< ISH increment step
+    uint32_t        dwDshIncrement = 0;     //!< DSH increment step
+    uint32_t        dwIshMaxSize = 0;       //!< ISH max size
+    uint32_t        dwDshMaxSize = 0;       //!< DSH max size
+
+    bool            m_keepIshLocked = false;       //!< Keep ISH locked always
+    bool            m_keepDshLocked = false;       //!< Keep DSH locked always
+
+    HeapManager::Behavior m_ishBehavior = HeapManager::Behavior::wait;    //!< ISH behavior
+    HeapManager::Behavior m_dshBehavior = HeapManager::Behavior::wait;    //!< DSH behavior
+
+    uint32_t        dwNumSyncTags = 0; //!< to be removed with old interfaces
+};
+
+typedef struct _MHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS
+{
+    int32_t                      *piSizes;               //<! [in] array of block sizes to allocate
+    int32_t                      iCount;                //<! [in] number of blocks to allocate
+    uint32_t                     dwAlignment;           //<! [in] block alignment
+    bool                         bHeapAffinity;         //<! [in] true if all blocks must be allocated in the same heap; false otherwize
+    PMHW_STATE_HEAP              pHeapAffinity;         //<! [in] Select a specific heap to allocate (nullptr if don't care)
+    uint32_t                     dwScratchSpace;        //<! [in/out] Scratch space requested, scratch space allocated in same heap as the block
+    PMHW_STATE_HEAP_MEMORY_BLOCK pScratchSpace;         //<! [out] Pointer to scratch space block used - needed for command buffer setup
+    bool                         bZeroAssignedMem;      //<! [in] Zero memory blocks after allocation
+    bool                         bStatic;               //<! [in] Block allocations are flaged as static
+    bool                         bGrow;                 //<! [in] Allow state heap to grow in order to satisfy the request
+} MHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS, *PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS;
+
+typedef MOS_STATUS ( *pfnAddResourceToCmd) (PMOS_INTERFACE , PMOS_COMMAND_BUFFER ,PMHW_RESOURCE_PARAMS);
+
+class XMHW_STATE_HEAP_INTERFACE
+{
+public:
+    static const uint32_t m_mhwBindingTableOffsetShift  = 6;
+    static const uint32_t m_mhwBindingTableSurfaceShift = 6;
+    static const uint32_t m_mhwGenericOffsetShift       = 6;
+    static const uint32_t m_mhwBindingTableOffsetAlignment = (1 << m_mhwBindingTableOffsetShift);
+    static const uint32_t m_mhwNumBindingTableEntryOffset  = (m_mhwBindingTableOffsetAlignment/4);
+
+protected:
+    HeapManager m_ishManager;
+    HeapManager m_dshManager;
+    std::vector<MemoryBlock> m_blocks;
+    std::vector<uint32_t> m_blockSizes;
+
+private:
+    MEDIA_WA_TABLE          *m_pWaTable;
+    MHW_STATE_HEAP_SETTINGS m_StateHeapSettings;
+
+    // old heap management
+    MOS_RESOURCE            m_resCmdBufIdGlobal;
+    uint32_t                *m_pdwCmdBufIdGlobal;
+    uint32_t                m_dwCurrCmdBufId;
+    PMHW_SYNC_TAG           m_pSyncTags;
+    uint32_t                m_dwCurrSyncTag;
+    uint32_t                m_dwInvalidSyncTagId; //!< Passed in at creation by the client
+    bool                    m_bRegisteredBBCompleteNotifyEvent;
+    PMHW_STATE_HEAP         m_pInstructionStateHeaps;
+    uint32_t                m_dwNumIsh;
+    uint32_t                m_dwNumDsh;
+    PMHW_STATE_HEAP         m_pDynamicStateHeaps;
+    int8_t                  m_bDynamicMode;     //!< To be deprecated, 0 - RenderHal handles, 1 - MDF heap management, 2 - generic hep
+    PMHW_BLOCK_MANAGER      m_pIshBlockManager; //!< ISH block management object
+    PMHW_BLOCK_MANAGER      m_pDshBlockManager; //!< DSH block management object
+
+public:
+    PMOS_INTERFACE          m_pOsInterface;
+    uint16_t                m_wIdAlignment;
+    uint16_t                m_wBtIdxAlignment;
+    uint16_t                m_wCurbeAlignment;
+    uint16_t                m_wSizeOfCmdSamplerState;
+    uint32_t                m_dwMaxSurfaceStateSize;
+    pfnAddResourceToCmd     m_pfnAddResourceToCmd;
+    MHW_STATE_HEAP          m_SurfaceStateHeap; //!< Simulated SSH with MHW_STATE_HEAP.
+    uint16_t                m_wSizeOfCmdInterfaceDescriptorData;
+    MHW_RENDER_STATE_SIZES  m_HwSizes;
+
+public:
+    //!
+    //! \brief Internal to MHW
+    //!
+
+    //!
+    //! \brief    Constructor of the MI StateHeap interface
+    //! \details  Internal MHW function to initialize all function pointers and some parameters
+    //! \param    [in] pCpInterface
+    //!           CP interface, must be valid
+    //! \param    [in] pOsInterface
+    //!           OS interface, must be valid
+    //!
+    XMHW_STATE_HEAP_INTERFACE(PMOS_INTERFACE pInputOSInterface, int8_t bDynamicMode=0);
+
+    XMHW_STATE_HEAP_INTERFACE(const XMHW_STATE_HEAP_INTERFACE&) = delete;
+
+    XMHW_STATE_HEAP_INTERFACE& operator=(const XMHW_STATE_HEAP_INTERFACE&) = delete;
+
+    virtual ~XMHW_STATE_HEAP_INTERFACE();
+
+    PMHW_STATE_HEAP GetDSHPointer(){ return   m_pDynamicStateHeaps; };
+
+    PMHW_STATE_HEAP GetISHPointer(){ return   m_pInstructionStateHeaps;};
+
+    uint32_t GetNumDsh(){return m_dwNumDsh;};
+
+    uint32_t GetNumIsh(){return m_dwNumIsh;};
+
+    PMOS_RESOURCE  GetResCmdBufIdGlobal(){return &m_resCmdBufIdGlobal;};
+
+    PMHW_SYNC_TAG  GetSycnTags(){return m_pSyncTags;};
+
+    uint16_t GetIdAlignment(){return m_wIdAlignment;};
+
+    uint16_t GetSizeofCmdSampleState(){return m_wSizeOfCmdSamplerState;};
+
+    uint16_t GetSizeofCmdInterfaceDescriptorData(){ return m_wSizeOfCmdInterfaceDescriptorData;};
+
+    uint16_t GetCurbeAlignment(){ return m_wCurbeAlignment;};
+
+    uint16_t GetBtIdxAlignment(){ return m_wBtIdxAlignment;};
+
+    uint32_t GetCurrCmdBufId(){ return m_dwCurrCmdBufId;};
+
+    uint32_t GetCmdBufIdGlobal(){ return *m_pdwCmdBufIdGlobal;};
+
+    uint32_t *GetCmdBufIdGlobalPointer(){ return m_pdwCmdBufIdGlobal; };
+
+    PMHW_RENDER_STATE_SIZES GetHwSizesPointer() { return & m_HwSizes;};
+
+    uint32_t GetSizeofSamplerStateAvs() { return m_HwSizes.dwSizeSamplerStateAvs;};
+
+    //!
+    //! \brief    Initializes the MI StateHeap interface
+    //! \details  Internal MHW function to initialize all function pointers and some parameters
+    //!           Assumes that the caller has checked pointer validity and whether or not an
+    //!           addressing method has been selected in the OS interface (bUsesGfxAddress or
+    //!           bUsesPatchList).
+    //! \param    [in] StateHeapSettings
+    //!           StateHeap setting passed from caller
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success else fail reason
+    MOS_STATUS InitializeInterface(MHW_STATE_HEAP_SETTINGS     StateHeapSettings);
+
+    //!
+    //! \brief    Assigns space in a state heap to a kernel state
+    //! \details  Client facing function to assign as space in a state heap a kernel state;
+    //!           if no space is available, a clean up is attempted 
+    //! \param    MHW_STATE_HEAP_TYPE StateHeapType
+    //!           [in] The state heap type requested (ISH/DSH)
+    //! \param    PMHW_KERNEL_STATE pKernelState
+    //!           [in] Kernel state to which a state heap space will be assigned
+    //! \param    uint32_t dwSpaceRequested
+    //!           [in] The amount of space requested from the state heap
+    //! \param    bool bStatic
+    //!           [in] Whether or not the space requested is static
+    //! \param    bool bZeroAssignedMem
+    //!           [in] Whether or not acquired memory should be zeroed
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, MOS_STATUS_CLIENT_AR_NO_SPACE if no space
+    //!           is available but it is possible for the client to wait, else fail reason
+    //!
+    MOS_STATUS AssignSpaceInStateHeap(
+        MHW_STATE_HEAP_TYPE         StateHeapType,
+        PMHW_KERNEL_STATE           pKernelState,
+        uint32_t                    dwSpaceRequested,
+        bool                        bStatic,
+        bool                        bZeroAssignedMem);
+
+    //!
+    //! \brief    Submits all non-static blocks in kernel state
+    //! \param    [in] pKernelState
+    //!           Kernel state containing all memory blocks to submit
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success
+    //!
+    MOS_STATUS SubmitBlocks(PMHW_KERNEL_STATE pKernelState);
+
+    //!
+    //! \brief    Locks requested state heap
+    //! \details  Client facing function to lock a state heap
+    //! \param    PMHW_STATE_HEAP pStateHeap
+    //!           [in] The state heap to be locked
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success
+    //!
+    MOS_STATUS LockStateHeap(
+        PMHW_STATE_HEAP             pStateHeap);
+
+    //!
+    //! \brief    Unlocks requested state heap
+    //! \details  Client facing function to unlock a state heap
+    //! \param    PMHW_STATE_HEAP pStateHeap
+    //!           [in] The state heap to be locked
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success
+    //!
+    MOS_STATUS UnLockStateHeap(
+        PMHW_STATE_HEAP             pStateHeap);
+
+    //!
+    //! \brief    Allocates a state heap of the requested type
+    //! \details  Client facing function to extend a state heap of the requested time, which
+    //!           involves allocating state heap and added it to the state heap liked list.
+    //! \param    MHW_STATE_HEAP_TYPE StateHeapType
+    //!           [in] The state heap type requested (ISH/DSH)
+    //! \param    uint32_t dwSizeRequested
+    //!           [in] The size of the state heap
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS ExtendStateHeap(
+        MHW_STATE_HEAP_TYPE         StateHeapType,
+        uint32_t                    dwSizeRequested);
+
+    //!
+    //! \brief    Update CmdBufIdGlobal
+    //! \details  Client facing function to update CmdBufIdGlobal
+    //!           reset current offset to zero
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS UpdateGlobalCmdBufId();
+
+    //!
+    //! \brief    Set command buffer status pointer
+    //! \details  Client facing function to set command buffer status pointer
+    //! \param    void  *pvCmdBufStatus
+    //!           [in] command buffer status pointer
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS SetCmdBufStatusPtr(void *pvCmdBufStatus);
+
+    //!
+    //! \brief    Calculate the space needed in the SSH
+    //! \details  Client facing function to calculate the space needed in the SSH
+    //!           given the number of binding table entries
+    //! \param    uint32_t dwBtEntriesRequested
+    //!           [in] Binding table entries requested in the SSH
+    //! \param    uint32_t *pdwSshSize
+    //!           [out] The size needed in the SSH
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS CalculateSshAndBtSizesRequested(
+        uint32_t                    dwBtEntriesRequested,
+        uint32_t                    *pdwSshSize,
+        uint32_t                    *pdwBtSize);
+
+    //!
+    //! \brief    Request SSH space for a command buffer.
+    //! \details  Client facing function to request SSH space for a command buffer, if not enough
+    //!           space is available, more will be requested.
+    //! \param    uint32_t dwBtEntriesRequested
+    //!           [in] Binding table entries requested in the SSH
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS RequestSshSpaceForCmdBuf(
+        uint32_t                    dwBtEntriesRequested);
+
+    //!
+    //! \brief    Calculates the amount of space needed
+    //! \details  Tells if there is enough space available in heap to load an array of blocks
+    //            Returns how much is missing (needs to be freed, 0 if none)
+    //! \param    MHW_STATE_HEAP_TYPE StateHeapType
+    //!           [in] State heap type (DSH/ISH)
+    //! \param    PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams
+    //!           [in] Dynamic state heap parameters
+    //! \return   uint32_t
+    //!           Amount of space needed in bytes
+    //!
+    uint32_t CalculateSpaceNeededDyn(
+        MHW_STATE_HEAP_TYPE                  StateHeapType,
+        PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams);
+
+    //Virtual Interfaces
+
+    //!
+    //! \brief    Adds INTERFACE_DESCRIPTOR command(s) to the DSH
+    //! \details  Client facing function to add INTERFACE_DESCRIPTOR(s) to the DSH
+    //! \param    uint32_t dwNumIdsToSet
+    //!           [in] The number of pParams
+    //! \param    PMHW_INTERFACE_DESCRIPTOR_PARAMS pParams
+    //!           [in] Parameters used to set the INTERFACE_DESCRIPTOR(s)
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS SetInterfaceDescriptor(
+        uint32_t                            dwNumIdsToSet,
+        PMHW_INTERFACE_DESCRIPTOR_PARAMS    pParams) = 0;
+
+    //!
+    //! \brief    Setup Media Interface Descriptor Entry in DSH
+    //! \details  Setup Single Media Interface Descriptor Entry
+    //! \param    PMHW_ID_ENTRY_PARAMS pParams
+    //!           [in] Interface Descriptor Parameters
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    //!
+    virtual MOS_STATUS SetInterfaceDescriptorEntry(
+        PMHW_ID_ENTRY_PARAMS                pParams) = 0;
+
+    //!
+    //! \brief    Adds media interface descriptor data to dynamic GSH
+    //! \param    PMHW_ID_ENTRY_PARAMS pParams
+    //!           [in] Interface descriptor parameters
+    //! \return   MOS_STATUS
+    //!
+    virtual MOS_STATUS AddInterfaceDescriptorData(
+        PMHW_ID_ENTRY_PARAMS                pParams) = 0;
+
+    //!
+    //! \brief    Adds a binding table to the SSH
+    //! \details  Client facing function to add binding table to SSH
+    //! \param    PMHW_KERNEL_STATE pKernelState
+    //!           [in] Kernel state to construct the binding table for
+    //! \param    void  *pvHwInterface
+    //!           [in] Temporary input parameter until SSH setup occurs in MHW
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS SetBindingTable(
+        PMHW_KERNEL_STATE                   pKernelState)= 0;
+
+    //!
+    //! \brief    Sets binding table entry in SSH
+    //! \details  TO BE REMOVED! Client facing function to add binding table to SSH
+    //! \param    PMHW_BINDING_TABLE_PARAMS pParams
+    //!           [in] Surface binding parameters
+    //!
+    virtual MOS_STATUS SetBindingTableEntry(
+        PMHW_BINDING_TABLE_PARAMS        pParams) = 0;
+
+    //!
+    //! \brief    Sends binding table entry to Command Buffer (indirect state)
+    //! \details  TO BE REMOVED! Sends binding table entry to indirect state heap in Cmd buffer,
+    //!           retrieving associated surface state offset and index
+    //! \param    PMHW_BINDING_TABLE_PARAMS pParams
+    //!           [in] Surface binding parameters - returns surface state pointer and index
+    //!
+    virtual MOS_STATUS SendBindingTableEntry(
+        PMHW_BINDING_TABLE_SEND_PARAMS   pParams) = 0;
+
+    //!
+    //! \brief    set surface state entry 
+    //! \details  TO BE REMOVED! set surface state entry
+    //! \param    PMHW_BINDING_TABLE_PARAMS pParams
+    //!           [in] Surface state parameters
+    //!
+    virtual MOS_STATUS SetSurfaceStateEntry(
+        PMHW_SURFACE_STATE_PARAMS   pParams) = 0;
+
+    //!
+    //! \brief    Set surface state in ssh
+    //! \details  Set sampler state in ssh
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] command buffer pointer
+    //! \param    uint32_t dwNumSurfaceStatesToSet
+    //!           [in] number of surface states need to set
+    //! \param    PMHW_RCS_SURFACE_PARAMS pParams
+    //!           [in] render surface state parameters
+    //!
+    virtual MOS_STATUS SetSurfaceState(
+        PMHW_KERNEL_STATE           pKernelState,
+        PMOS_COMMAND_BUFFER         pCmdBuffer,
+        uint32_t                    dwNumSurfaceStatesToSet,
+        PMHW_RCS_SURFACE_PARAMS     pParams) = 0;
+
+    //!
+    //! \brief    Set sampler state
+    //! \details  Set sampler state
+    //! \param    PMHW_SAMPLER_STATE_PARAM pParams
+    //!           [in] Sampler state parameters
+    //!
+    virtual MOS_STATUS SetSamplerState(
+        void                        *pSampler,
+        PMHW_SAMPLER_STATE_PARAM    pParam) = 0;
+
+    //!
+    //! \brief    Adds sampler state data to dynamic GSH
+    //! \param    uint32_t samplerOffset
+    //!           [in] sampler offset
+    //! \param    MemoryBlock memoryBlock
+    //!           [in,out] Pointer to memory block
+    //! \param    PMHW_SAMPLER_STATE_PARAM pParam
+    //!           [in] sampler state parameters
+    //! \return   MOS_STATUS
+    //!
+    virtual MOS_STATUS AddSamplerStateData(
+        uint32_t                    samplerOffset,
+        MemoryBlock                 *memoryBlock,
+        PMHW_SAMPLER_STATE_PARAM    pParam) = 0;
+
+    //!
+    //! \brief    Initialize sampler states
+    //! \details  Initialize sampler states
+    //! \param    void  *pSamplerStates
+    //!           [in] Pointer to sampler states to reset
+    //! \param    int32_t iSamplers
+    //!           [in] Number of sampler entries to reset
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS InitSamplerStates(
+        void                        *pSamplerStates,
+        int32_t                     iSamplers) = 0;
+
+    //!
+    //! \brief    Init HwSizes
+    //! \details  Init HwSizes 
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success else fail reason
+    //!
+    virtual MOS_STATUS InitHwSizes() = 0;
+
+    //!
+    //! \brief    Releases the dynamic state heap
+    //! \details  Releases the dynamic state heap. If all blocks
+    //!           are completed, free the resource. If there are some blocks still in
+    //!           the submitted state, then mark blocks for deletion. This function will be
+    //!           called again to free the resource when the last block is released. 
+    //! \param    PMHW_STATE_HEAP pStateHeap
+    //!           [in] Pointer to the state heap to be released
+    //! \return   MOS_STATUS
+    //!           SUCCESS    if state heap was either marked for deletion or actually freed
+    //!
+    MOS_STATUS ReleaseStateHeapDyn(PMHW_STATE_HEAP pStateHeap);
+
+    //!
+    //! \brief    Allocates a dynamic block
+    //! \details  Allocates either a single dynamic block or multiple blocks in ISH/DSH
+    //! \param    MHW_STATE_HEAP_TYPE StateHeapType
+    //!           [in] State heap type (DSH/ISH)
+    //! \param    PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams
+    //!           [in] Dynamic state heap parameters
+    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
+    //!           Pointer to the allocated memory block(s)
+    //!
+    PMHW_STATE_HEAP_MEMORY_BLOCK AllocateDynamicBlockDyn(
+        MHW_STATE_HEAP_TYPE                  StateHeapType,
+        PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams);
+
+    //!
+    //! \brief    Submits a dynamic block
+    //! \details  Submits a dynamic block. Detaches the block from current list and adds to to
+    //!           submitted list. Updates block with provided sync tag.
+    //! \param    MHW_STATE_HEAP_TYPE StateHeapType
+    //!           [in] State heap type (DSH/ISH)
+    //! \param    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock
+    //!           [in] Pointer to memory block to be submitted
+    //! \param    uint32_t dwSyncTag
+    //!           [in] Sync Tag
+    //! \return   MOS_STATUS
+    //!           SUCCESS    if submission was successful
+    //!
+    MOS_STATUS SubmitDynamicBlockDyn(
+            MHW_STATE_HEAP_TYPE                  StateHeapType,
+            PMHW_STATE_HEAP_MEMORY_BLOCK         pBlock,
+            const FrameTrackerTokenFlat          *trackerToken);
+
+    //!
+    //! \brief    Frees a dynamic block
+    //! \details  Detaches the block from current list if block has completed (based on provided dwSyncTag)
+    //!           and adds it to deleted list. Otherwise, marks for deletion upon completion.
+    //!           submitted list. Updates block with provided sync tag.
+    //! \param    MHW_STATE_HEAP_TYPE StateHeapType
+    //!           [in] State heap type (DSH/ISH)
+    //! \param    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock
+    //!           [in] Pointer to memory block to be freed
+    //! \return   MOS_STATUS
+    //!           SUCCESS    if operation was successful
+    //!
+    MOS_STATUS FreeDynamicBlockDyn(
+            MHW_STATE_HEAP_TYPE                  StateHeapType,
+            PMHW_STATE_HEAP_MEMORY_BLOCK         pBlock);
+
+    //!
+    //! \brief    Refresh the dynamic heap
+    //! \details  Updates block states based on last executed tag
+    //!           submitted unlocked blocks are released;
+    //!           move to allocated
+    //! \param    MHW_STATE_HEAP_TYPE StateHeapType
+    //!           [in] State heap type (DSH/ISH)
+    //! \param    uint32_t dwSyncTag
+    //!           [in] Sync Tag
+    //! \return   MOS_STATUS
+    //!           SUCCESS    if operation was successful
+    //!
+    MOS_STATUS RefreshDynamicHeapDyn (
+        MHW_STATE_HEAP_TYPE         StateHeapType);
+
+private:
+
+    //!
+    //! \brief    Insert a node into a memory block linked list
+    //! \details  MHW private function which maintains the memory block linked list
+    //! \param    PMHW_STATE_HEAP_MEMORY_BLOCK pStartNode
+    //!           [in] The memory block from which to start the insertion
+    //! \param    PMHW_STATE_HEAP_MEMORY_BLOCK pNodeToAdd
+    //!           [in] The memory block  to insert
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success else fail reason
+    //!
+    MOS_STATUS InsertLinkedList(
+        PMHW_STATE_HEAP_MEMORY_BLOCK    pStartNode,
+        PMHW_STATE_HEAP_MEMORY_BLOCK    pNodeToAdd);
+
+    //!
+    //! \brief    Allocate and initialize a memory block based on input parameters
+    //! \details  MHW private function which creates memory blocks
+    //! \param    PMHW_STATE_HEAP pStateHeap
+    //!           [in] The state heap which the memory block belongs to
+    //! \param    PMHW_STATE_HEAP_MEMORY_BLOCK ppMemoryBlock
+    //!           [in/out] The node to insert.
+    //! \param    uint32_t dwRequestedSize
+    //!           [in] The size of the memory that the memory block references.
+    //! \param    bool bStatic
+    //!           [in] If the memory block is static
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success else fail reason
+    //!
+    MOS_STATUS InitMemoryBlock(
+        PMHW_STATE_HEAP                 pStateHeap,
+        PMHW_STATE_HEAP_MEMORY_BLOCK    *ppMemoryBlock,
+        uint32_t                        dwRequestedSize,
+        bool                            bStatic);
+
+    //!
+    //! \brief    Inserts a new memory block into an existing available memory block
+    //! \details  MHW private function to insert new memory blocks into available memory blocks
+    //! \param    PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlockFree
+    //!           [in] Available memory block
+    //! \param    PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlockToAdd
+    //!           [in] New memory block to be inserted
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success else fail reason
+    //!
+    MOS_STATUS InsertMemoryBlock(
+        PMHW_STATE_HEAP_MEMORY_BLOCK    pMemoryBlockFree,
+        PMHW_STATE_HEAP_MEMORY_BLOCK    pMemoryBlockToAdd);
+
+    //!
+    //! \brief    Returns the space of the memory block to the state heap
+    //! \details  MHW private function to return the memory block space to the state heap
+    //!           by marking it as available and merging it with adjacent memory blocks
+
+    //! \param    PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlock
+    //!           [in] Memory block to return to the state heap
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success else fail reason
+    //!
+    MOS_STATUS ReturnSpaceMemoryBlock(
+        PMHW_STATE_HEAP_MEMORY_BLOCK    pMemoryBlock);
+
+    //Interfaces different cross static and dynmaic mode
+
+    //!
+    //! \brief    Extends the dynamic state heap
+    //! \details  Allocates a dynamic state heap (ISH/DSH) with requested size
+    //! \param    MHW_STATE_HEAP_TYPE StateHeapType
+    //!           [in] State heap type (i.e. ISH/DSH)
+    //! \param    uint32_t dwSizeRequested
+    //!           [in] Size of requested state heap
+    //! \return   MOS_STATUS
+    //!           SUCCESS    if state heap was successfully allocated
+    //!
+    MOS_STATUS ExtendStateHeapDyn(
+        MHW_STATE_HEAP_TYPE         StateHeapType,
+        uint32_t                    dwSizeRequested);
+
+    //!
+    //! \brief    Extends the dynamic state heap
+    //! \details  Allocates a dynamic state heap (ISH/DSH) with requested size
+    //! \param    MHW_STATE_HEAP_TYPE StateHeapType
+    //!           [in] State heap type (i.e. ISH/DSH)
+    //! \param    uint32_t dwSizeRequested
+    //!           [in] Size of requested state heap
+    //! \return   MOS_STATUS
+    //!           SUCCESS    if state heap was successfully allocated
+    //!
+    MOS_STATUS ExtendStateHeapSta(
+        MHW_STATE_HEAP_TYPE         StateHeapType,
+        uint32_t                    dwSizeRequested);
+
+};
+
+struct _MHW_STATE_HEAP_INTERFACE
+{
+
+    XMHW_STATE_HEAP_INTERFACE               *pStateHeapInterface;
+
+    //!
+    //! \brief Internal to MHW
+    //!
+
+    MOS_STATUS (*pfnCreate) (
+        PMHW_STATE_HEAP_INTERFACE   *ppStateHeapInterface,
+        MHW_STATE_HEAP_SETTINGS     StateHeapSettings);
+
+    MOS_STATUS (*pfnDestroy) (
+        PMHW_STATE_HEAP_INTERFACE   pCommonStateHeapInterface);
+
+    //!
+    //! \brief Primarily a state heap interface private function to be
+    //!        called as a pair in any state heap interface function which
+    //!        accesses the graphics resource like AddDataToStateHeap.
+    //!
+    MOS_STATUS (*pfnLockStateHeap) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface,
+        PMHW_STATE_HEAP                    pStateHeap);
+
+    MOS_STATUS (*pfnUnlockStateHeap) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface,
+        PMHW_STATE_HEAP                    pStateHeap);
+
+    //!
+    //! \brief Client facing functions
+    //!
+    MOS_STATUS (*pfnAssignSpaceInStateHeap) (
+        PMHW_STATE_HEAP_INTERFACE   pCommonStateHeapInterface,
+        MHW_STATE_HEAP_TYPE         StateHeapType,
+        PMHW_KERNEL_STATE           pKernelState,
+        uint32_t                    dwSpaceRequested,
+        bool                        bStatic,
+        bool                        bZeroAssignedMem);
+
+    MOS_STATUS(*pfnSubmitBlocks) (
+        PMHW_STATE_HEAP_INTERFACE   pCommonStateHeapInterface,
+        PMHW_KERNEL_STATE           pKernelState);
+
+    MOS_STATUS (*pfnExtendStateHeap) (
+        PMHW_STATE_HEAP_INTERFACE   pCommonStateHeapInterface,
+        MHW_STATE_HEAP_TYPE         StateHeapType,
+        uint32_t                    dwSizeRequested);
+
+    MOS_STATUS (*pfnSetInterfaceDescriptor) (
+        PMHW_STATE_HEAP_INTERFACE           pCommonStateHeapInterface,
+        uint32_t                            dwNumIdsToSet,
+        PMHW_INTERFACE_DESCRIPTOR_PARAMS    pParams);
+
+    MOS_STATUS (*pfnSetInterfaceDescriptorEntry) (
+        PMHW_STATE_HEAP_INTERFACE           pCommonStateHeapInterface,
+        PMHW_ID_ENTRY_PARAMS                pParams);
+
+    MOS_STATUS(*pfnSetBindingTable) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface,
+        PMHW_KERNEL_STATE                  pKernelState);
+
+    MOS_STATUS (*pfnSetSurfaceState) (
+        PMHW_STATE_HEAP_INTERFACE           pCommonStateHeapInterface,
+        PMHW_KERNEL_STATE                   pKernelState,
+        PMOS_COMMAND_BUFFER                 pCmdBuffer,
+        uint32_t                            dwNumSurfaceStatesToSet,
+        PMHW_RCS_SURFACE_PARAMS             pParams);
+
+    MOS_STATUS (*pfnSetSurfaceStateBuffer) (
+        PMHW_STATE_HEAP_INTERFACE           pCommonStateHeapInterface,
+        PMHW_RCS_SURFACE_PARAMS             pParams,
+        void                                *pSurfaceState);
+
+    MOS_STATUS (*pfnSetBindingTableEntry) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface,
+        PMHW_BINDING_TABLE_PARAMS          pParams);
+
+    MOS_STATUS (*pfnSendBindingTableEntry) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface,
+        PMHW_BINDING_TABLE_SEND_PARAMS     pParams);
+
+    MOS_STATUS (* pfnSetSurfaceStateToken) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface,
+        PMHW_SURFACE_TOKEN_PARAMS          pParams,
+        void                               *pSurfaceStateToken);
+
+    MOS_STATUS (*pfnSetSurfaceStateEntry) (
+        PMHW_STATE_HEAP_INTERFACE           pCommonStateHeapInterface,
+        PMHW_SURFACE_STATE_PARAMS           pParams);
+
+    MOS_STATUS (*pfnSendSurfaceStateEntry) (
+        PMHW_STATE_HEAP_INTERFACE           pCommonStateHeapInterface,
+        PMOS_COMMAND_BUFFER                 pCmdBuffer,
+        PMHW_SURFACE_STATE_SEND_PARAMS      pParams);
+
+    //!
+    //! \brief May only operate on the primary state heap.
+    //!
+    MOS_STATUS (*pfnCompactStateHeap) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface,
+        MHW_STATE_HEAP_TYPE                StateHeapType);
+
+    //!
+    //! \brief Must be called by the client directly to provide
+    //!        pointer for command buffer status for tracking purposes.
+    //!
+    MOS_STATUS(*pfnSetCmdBufStatusPtr) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface,
+        void                               *pvCmdBufStatus);
+
+    //!
+    //! \brief Must be called by the client directly after a command
+    //!        buffer containing a kernel workload is submitted.
+    //!
+    MOS_STATUS(*pfnUpdateGlobalCmdBufId) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface);
+
+    //!
+    //! \brief Must be called by the client before the client gets a
+    //!        command buffer for a kernel workload from MOS. This function
+    //!        will resize the SSH the current size is < dwBtEntriesRequested,
+    //!        otherwise it does nothing. In the future when SSHes are 
+    //!        managed entirely in UMD this function may be deprecated and 
+    //!        the SSH may be treated like the
+    //!        other state heaps.
+    //!
+    MOS_STATUS (*pfnRequestSshSpaceForCmdBuf) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface,
+        uint32_t                           dwBtEntriesRequested);
+
+    MOS_STATUS (*pfnCalculateSshAndBtSizesRequested) (
+        PMHW_STATE_HEAP_INTERFACE   pCommonStateHeapInterface,
+        uint32_t                    dwBtEntriesRequested,
+        uint32_t                    *pdwSshSize,
+        uint32_t                    *pdwBtSize);
+
+    MOS_STATUS(* pfnInitSamplerStates) (
+        PMHW_STATE_HEAP_INTERFACE   pCommonStateHeapInterface,
+        void                        *pSampler,
+        int32_t                     iSamplers);
+
+    MOS_STATUS (* pfnSetSamplerState) (
+        PMHW_STATE_HEAP_INTERFACE          pCommonStateHeapInterface,
+        void                               *pSampler,
+        PMHW_SAMPLER_STATE_PARAM           pParams);
+
+    //Interfaces in dynamic mode
+    uint32_t (*pfnCalculateDynamicSpaceNeeded) (
+        PMHW_STATE_HEAP_INTERFACE            pStateHeapInterface,
+        MHW_STATE_HEAP_TYPE                  StateHeapType,
+        PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams);
+
+    PMHW_STATE_HEAP_MEMORY_BLOCK (*pfnAllocateDynamicBlock) (
+        PMHW_STATE_HEAP_INTERFACE            pStateHeapInterface,
+        MHW_STATE_HEAP_TYPE                  StateHeapType,
+        PMHW_STATE_HEAP_DYNAMIC_ALLOC_PARAMS pParams);
+
+    MOS_STATUS (*pfnSubmitDynamicBlock) (
+        PMHW_STATE_HEAP_INTERFACE            pStateHeapInterface,
+        MHW_STATE_HEAP_TYPE                  StateHeapType,
+        PMHW_STATE_HEAP_MEMORY_BLOCK         pBlock,
+        FrameTrackerTokenFlat                *trackerToken);
+
+    MOS_STATUS (*pfnFreeDynamicBlock) (
+        PMHW_STATE_HEAP_INTERFACE            pStateHeapInterface,
+        MHW_STATE_HEAP_TYPE                  StateHeapType,
+        PMHW_STATE_HEAP_MEMORY_BLOCK         pBlock);
+
+    MOS_STATUS (*pfnRefreshDynamicHeap) (
+        PMHW_STATE_HEAP_INTERFACE            pStateHeapInterface,
+        MHW_STATE_HEAP_TYPE                  StateHeapType);
+
+    MOS_STATUS (*pfnReleaseStateHeap) (
+        PMHW_STATE_HEAP_INTERFACE            pStateHeapInterface,
+        PMHW_STATE_HEAP                      pStateHeap);
+
+};
+
+MOS_STATUS Mhw_StateHeapInterface_AssignInterfaces(
+    PMHW_STATE_HEAP_INTERFACE    pCommonStateHeapInterface);
+
+MOS_STATUS Mhw_StateHeapInterface_InitInterface(
+    PMHW_STATE_HEAP_INTERFACE   *ppCommonStateHeapInterface,
+    PMOS_INTERFACE               pOsInterface,
+    uint8_t                      bDynamicMode);
+
+extern const uint8_t g_cMhw_VDirection[MHW_NUM_FRAME_FIELD_TYPES];
+
+#endif // __MHW_STATE_HEAP_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_utilities.h 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_utilities.h
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_utilities.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_utilities.h	2022-07-19 15:03:31.000000000 +0000
@@ -33,9 +33,4 @@ MOS_STATUS Mhw_SendGenericPrologCmd(
     PMHW_GENERIC_PROLOG_PARAMS  pParams,
     MHW_MI_MMIOREGISTERS       *pMmioReg = nullptr);
 
-MOS_STATUS Mhw_SendGenericPrologCmd_Next(
-    PMOS_COMMAND_BUFFER         pCmdBuffer,
-    PMHW_GENERIC_PROLOG_PARAMS  pParams,
-    MHW_MI_MMIOREGISTERS        *pMmioReg = nullptr);
-
 #endif // __MHW_UTILITIES_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_vebox.h 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_vebox.h
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/mhw_vebox.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/mhw_vebox.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,1247 @@
+/*
+* Copyright (c) 2014-2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     mhw_vebox.h
+//! \brief    MHW interface for constructing commands for the VEBOX
+//! \details  Impelements the functionalities common across all platforms for MHW_VEBOX
+//!
+
+#ifndef __MHW_VEBOX_H__
+#define __MHW_VEBOX_H__
+
+#include "mos_os.h"
+#include "mhw_utilities.h"
+#include "mhw_cp_interface.h"
+#include "mhw_mi.h"
+#include <math.h>
+
+#define MHW_FORWARD_GAMMA_SEGMENT_COUNT       1024    //!< Forward Gamma Correction MAX Control Points
+
+//!
+//! \brief  VEBOX constants
+//!
+#define MHW_VEBOX_MIN_HEIGHT      16
+#define MHW_VEBOX_MIN_WIDTH       64
+#define MHW_VEBOX_LINEAR_PITCH    64
+//!
+//! \brief  ACE constants
+//!
+#define MHW_NUM_ACE_PWLF_COEFF    5
+
+//!
+//! \brief  Vebox DNDI constants
+//!
+#define DNDI_HISTORY_INITVALUE                      0xFF
+
+//!
+//! \brief  Vebox Denoise pixel range threshold numbers
+//!
+#define MHW_PIXRANGETHRES_NUM     6
+
+//!
+//! \brief  STE Parameters
+//!
+#define MHW_STE_OPTIMAL           3  // for perfect HD-HQV Score
+
+//!
+//! \brief  Default size of area for sync, debugging, performance collecting
+//!
+#define MHW_SYNC_SIZE   128 // range: (128 ... 4096)
+
+//!
+//! \brief  Default number of media states (Dynamic GSH mode)
+//!
+#define MHW_MAX_VEBOX_STATES    16
+
+#define MHW_PI                     3.14159265358979324f         //!< Definition the const pi
+
+//!
+//! \def MHW_DEGREE_TO_RADIAN(degree)
+//! Convert \a degree value to \a radian value.
+//!
+#define MHW_DEGREE_TO_RADIAN(degree)   (degree) * (MHW_PI) / 180
+#define AVS_TBL_COEF_PREC         6           //!< Table coef precision (after decimal point
+#define SAME_SAMPLE_THRESHOLD     1000        //!< When checking whether 2 timestamps are the same, leave room for some error
+
+#define MHW_VEBOX_WATCHDOG_ENABLE_COUNTER                 0x0
+#define MHW_VEBOX_WATCHDOG_DISABLE_COUNTER                0xFFFFFFFF
+#define MHW_VEBOX_TIMEOUT_MS                              60
+
+typedef MhwMiInterface *PMHW_MI_INTERFACE;
+
+//!
+//! \brief Color Spaces enum
+//!
+typedef enum _MHW_CSPACE
+{
+    MHW_CSpace_None     = -5        ,   //!< Unidentified
+    MHW_CSpace_Source   = -4        ,   //!< Current source Color Space
+
+    // Groups of Color Spaces
+    MHW_CSpace_RGB      = -3        ,   //!< sRGB
+    MHW_CSpace_YUV      = -2        ,   //!< YUV BT601 or BT709 - non xvYCC
+    MHW_CSpace_Gray     = -1        ,   //!< Gray scale image with only Y component
+    MHW_CSpace_Any      =  0        ,   //!< Any
+
+    // Specific Color Spaces
+    MHW_CSpace_sRGB                 ,   //!< RGB - sRGB       -   RGB[0,255]
+    MHW_CSpace_stRGB                ,   //!< RGB - stRGB      -   RGB[16,235]
+    MHW_CSpace_BT601                ,   //!< YUV BT.601 Y[16,235] UV[16,240]
+    MHW_CSpace_BT601_FullRange      ,   //!< YUV BT.601 Y[0,255]  UV[-128,+127]
+    MHW_CSpace_BT709                ,   //!< YUV BT.709 Y[16,235] UV[16,240]
+    MHW_CSpace_BT709_FullRange      ,   //!< YUV BT.709 Y[0,255]  UV[-128,+127]
+    MHW_CSpace_xvYCC601             ,   //!< xvYCC 601 Y[16,235]  UV[16,240]
+    MHW_CSpace_xvYCC709             ,   //!< xvYCC 709 Y[16,235]  UV[16,240]
+    MHW_CSpace_BT601Gray            ,   //!< BT.601 Y[16,235]
+    MHW_CSpace_BT601Gray_FullRange  ,   //!< BT.601 Y[0,255]
+    MHW_CSpace_BT2020               ,   //!< BT.2020 YUV Limited Range 10bit Y[64, 940] UV[64, 960]
+    MHW_CSpace_BT2020_FullRange     ,   //!< BT.2020 YUV Full Range 10bit [0, 1023]
+    MHW_CSpace_BT2020_RGB           ,   //!< BT.2020 RGB Full Range 10bit [0, 1023]
+    MHW_CSpace_BT2020_stRGB         ,   //!< BT.2020 RGB Studio Range 10bit [64, 940]
+    MHW_CSpace_Count                    //!< Keep this at the end
+} MHW_CSPACE;
+C_ASSERT(MHW_CSpace_Count == 15);
+
+//!
+//! \brief Gamut Mode enum
+//!
+typedef enum _MHW_GAMUT_MODE
+{
+    MHW_GAMUT_MODE_NONE,
+    MHW_GAMUT_MODE_BASIC,
+    MHW_GAMUT_MODE_ADVANCED,
+    MHW_GAMUT_MODE_CUSTOMIZED
+} MHW_GAMUT_MODE;
+C_ASSERT(MHW_GAMUT_MODE_CUSTOMIZED == 3);
+
+//!
+//! \brief Gamma Values configuration enum
+//!
+typedef enum _MHW_GAMMA_VALUE
+{
+    MHW_GAMMA_1P0 = 0,
+    MHW_GAMMA_2P2,
+    MHW_GAMMA_2P6
+} MHW_GAMMA_VALUE;
+C_ASSERT(MHW_GAMMA_2P6 == 2);
+
+//!
+//! \brief  Structure to Vebox Mode
+//!
+typedef struct _MHW_VEBOX_MODE
+{
+    uint32_t    ColorGamutExpansionEnable           : 1;
+    uint32_t    ColorGamutCompressionEnable         : 1;
+    uint32_t    GlobalIECPEnable                    : 1;
+    uint32_t    DNEnable                            : 1;
+    uint32_t    DIEnable                            : 1;
+    uint32_t    DNDIFirstFrame                      : 1;
+    uint32_t    DIOutputFrames                      : 2;
+    uint32_t    PipeSynchronizeDisable              : 1;
+    uint32_t    DemosaicEnable                      : 1;  // Gen8+
+    uint32_t    VignetteEnable                      : 1;  // Gen8+
+    uint32_t    AlphaPlaneEnable                    : 1;
+    uint32_t    HotPixelFilteringEnable             : 1;  // Gen8+
+    uint32_t    SingleSliceVeboxEnable              : 2;  // Gen9+
+    uint32_t    LACECorrectionEnable                : 1;  // Gen9+
+    uint32_t    DisableEncoderStatistics            : 1;  // Gen9+
+    uint32_t    DisableTemporalDenoiseFilter        : 1;  // Gen9+
+    uint32_t    SinglePipeIECPEnable                : 1;  // Gen9+
+    uint32_t    SFCParallelWriteEnable              : 1;  // Gen9+
+    uint32_t    ScalarMode                          : 1;  // Gen10+
+    uint32_t    ForwardGammaCorrectionEnable        : 1;  // Gen9+
+    uint32_t    Hdr1DLutEnable                      : 1;
+    uint32_t    Fp16ModeEnable                      : 1;
+    uint32_t    Hdr1K1DLut                          : 1;
+    uint32_t                                        : 7; // Reserved
+} MHW_VEBOX_MODE, *PMHW_VEBOX_MODE;
+
+typedef enum _MHW_VEBOX_ADDRESS_SHIFT
+{
+    MHW_VEBOX_DI_IECP_SHIFT                    = 12,
+} MHW_VEBOX_ADDRESS_SHIFT;
+
+//!
+//! \brief  Structure to Chroma Sampling to handle VEBOX_STATE_CMD Command
+//!
+typedef struct _MHW_VEBOX_CHROMA_SAMPLING
+{
+    uint32_t    ChromaUpsamplingCoSitedHorizontalOffset     : 2;
+    uint32_t    ChromaUpsamplingCoSitedVerticalOffset       : 3;
+    uint32_t    ChromaDownsamplingCoSitedHorizontalOffset   : 2;
+    uint32_t    ChromaDownsamplingCoSitedVerticalOffset     : 3;
+    uint32_t    BypassChromaUpsampling                      : 1;
+    uint32_t    BypassChromaDownsampling                    : 1;
+    uint32_t                                                : 20; // Reserved
+} MHW_VEBOX_CHROMA_SAMPLING, *PMHW_VEBOX_CHROMA_SAMPLING;
+
+typedef struct _MHW_VEBOX_3D_LUT
+{
+    uint32_t    ArbitrationPriorityControl                  : 2;
+    uint32_t    Lut3dEnable                                 : 1;
+    uint32_t    Lut3dSize                                   : 2;
+    uint32_t    ChannelMappingSwapForLut3D                  : 1;
+    uint32_t                                                : 26; // Reserved
+} MHW_VEBOX_3D_LUT, *PMHW_VEBOX_3D_LUT;
+
+//!
+//! \brief  Structure to handle VEBOX_STATE_CMD Command
+//!
+typedef struct _MHW_VEBOX_STATE_CMD_PARAMS
+{
+    MHW_VEBOX_MODE                      VeboxMode;
+    MHW_VEBOX_CHROMA_SAMPLING           ChromaSampling;
+    MHW_VEBOX_3D_LUT                    LUT3D;
+    bool                                bUseVeboxHeapKernelResource;
+    PMOS_RESOURCE                       pLaceLookUpTables;
+    PMOS_RESOURCE                       pVeboxParamSurf;
+    PMOS_RESOURCE                       pVebox3DLookUpTables;
+    PMOS_RESOURCE                       pVebox1DLookUpTables;
+    MOS_RESOURCE                        DummyIecpResource;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    LaceLookUpTablesSurfCtrl;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    Vebox3DLookUpTablesSurfCtrl;
+    bool                                bNoUseVeboxHeap;
+} MHW_VEBOX_STATE_CMD_PARAMS, *PMHW_VEBOX_STATE_CMD_PARAMS;
+
+//!
+//! \brief  VEBOX DNDI parameters
+//!
+typedef struct _MHW_VEBOX_DNDI_PARAMS
+{
+    // DI and Luma Denoise Params
+    uint32_t  dwDenoiseASDThreshold = 0;
+    uint32_t  dwDenoiseHistoryDelta = 0;
+    uint32_t  dwDenoiseMaximumHistory = 0;
+    uint32_t  dwDenoiseSTADThreshold  = 0;
+    uint32_t  dwDenoiseSCMThreshold   = 0;
+    uint32_t  dwDenoiseMPThreshold    = 0;
+    uint32_t  dwLTDThreshold          = 0;
+    uint32_t  dwTDThreshold           = 0;
+    uint32_t  dwGoodNeighborThreshold = 0;
+    bool      bDNDITopFirst           = false;
+    bool      bProgressiveDN          = false;
+    uint32_t  dwFMDFirstFieldCurrFrame  = 0;
+    uint32_t  dwFMDSecondFieldPrevFrame = 0;
+
+    // Pixel Range Threshold Array for 5x5 Spatial Filter
+    uint32_t dwPixRangeThreshold[MHW_PIXRANGETHRES_NUM] = {};
+    uint32_t dwPixRangeWeight[MHW_PIXRANGETHRES_NUM]    = {};
+
+    // Chroma Denoise Params
+    uint32_t  dwHistoryInitUV = 0;
+    uint32_t  dwChromaSTADThreshold = 0;
+    uint32_t  dwChromaLTDThreshold  = 0;
+    uint32_t  dwChromaTDThreshold   = 0;
+    bool      bChromaDNEnable       = false;
+
+    // Hot Pixel Params
+    uint32_t dwHotPixelThreshold = 0;
+    uint32_t dwHotPixelCount     = 0;
+
+    // CNL New DI
+    uint32_t  dwLumaTDMWeight   = 0;
+    uint32_t  dwChromaTDMWeight = 0;
+    uint32_t  dwSHCMDelta       = 0;
+    uint32_t  dwSHCMThreshold   = 0;
+    uint32_t  dwSVCMDelta       = 0;
+    uint32_t  dwSVCMThreshold   = 0;
+    bool      bFasterConvergence      = false;
+    bool      bTDMLumaSmallerWindow   = false;
+    bool      bTDMChromaSmallerWindow = false;
+    uint32_t  dwLumaTDMCoringThreshold   = 0;
+    uint32_t  dwChromaTDMCoringThreshold = 0;
+    bool      bBypassDeflickerFilter     = false;
+    bool      bUseSyntheticContentMedian = false;
+    bool      bLocalCheck                = false;
+    bool      bSyntheticContentCheck     = false;
+    bool      bSyntheticFrame            = false;
+    bool      bSCDEnable                 = false;
+    uint32_t  dwDirectionCheckThreshold  = 0;
+    uint32_t  dwTearingLowThreshold      = 0;
+    uint32_t  dwTearingHighThreshold     = 0;
+    uint32_t  dwDiffCheckSlackThreshold  = 0;
+    uint32_t  dwSADWT0                   = 0;
+    uint32_t  dwSADWT1                   = 0;
+    uint32_t  dwSADWT2                   = 0;
+    uint32_t  dwSADWT3                   = 0;
+    uint32_t  dwSADWT4                   = 0;
+    uint32_t  dwSADWT6                   = 0;
+    uint32_t  dwLPFWtLUT0                = 0;
+    uint32_t  dwLPFWtLUT1                = 0;
+    uint32_t  dwLPFWtLUT2                = 0;
+    uint32_t  dwLPFWtLUT3                = 0;
+    uint32_t  dwLPFWtLUT4                = 0;
+    uint32_t  dwLPFWtLUT5                = 0;
+    uint32_t  dwLPFWtLUT6                = 0;
+    uint32_t  dwLPFWtLUT7                = 0;
+
+    //for SlimIPUDenoise
+    void *    pSystemMem            = nullptr;
+    uint32_t  MemSizeInBytes        = 0;
+    bool      bEnableSlimIPUDenoise = false;
+
+    // FDFB
+    bool      dndistateforFDFB      = false;
+} MHW_VEBOX_DNDI_PARAMS, *PMHW_VEBOX_DNDI_PARAMS;
+
+//!
+//! \brief  VEBOX Chroma parameters
+//!
+typedef struct _MHW_VEBOX_CHROMA_PARAMS
+{
+    uint32_t dwPixRangeThresholdChromaU[MHW_PIXRANGETHRES_NUM];
+    uint32_t dwPixRangeWeightChromaU[MHW_PIXRANGETHRES_NUM];
+    uint32_t dwPixRangeThresholdChromaV[MHW_PIXRANGETHRES_NUM];
+    uint32_t dwPixRangeWeightChromaV[MHW_PIXRANGETHRES_NUM];
+    uint32_t dwHotPixelThresholdChromaU;
+    uint32_t dwHotPixelCountChromaU;
+    uint32_t dwHotPixelThresholdChromaV;
+    uint32_t dwHotPixelCountChromaV;
+} MHW_VEBOX_CHROMA_PARAMS;
+
+//!
+//! Structure MHW_STE_PARAMS
+//! \brief STE parameters - Skin Tone Enhancement
+//!
+typedef struct _MHW_STE_PARAMS
+{
+    uint32_t            dwSTEFactor;
+    uint32_t            satP1;
+    uint32_t            satS0;
+    uint32_t            satS1;
+} MHW_STE_PARAMS, *PMHW_STE_PARAMS;
+
+//!
+//! Structure MHW_TCC_PARAMS
+//! \brief TCC parameters - Total Color Control
+//!
+typedef struct _MHW_TCC_PARAMS
+{
+    uint8_t             Red;
+    uint8_t             Green;
+    uint8_t             Blue;
+    uint8_t             Cyan;
+    uint8_t             Magenta;
+    uint8_t             Yellow;
+} MHW_TCC_PARAMS, *PMHW_TCC_PARAMS;
+
+//!
+//! Structure MHW_LACE_PARAMS
+//! \brief LACE parameters - Local Adaptive Contrast Enhancement
+//!
+typedef struct _MHW_LACE_PARAMS
+{
+    bool                bSTD;                               // To enable Skin Tone Special handling
+    uint32_t            dwStrength;                         // LACE strength
+    uint16_t            wMinAceLuma;                        // Minimum Luma for which ACE has to be applied
+    uint16_t            wMaxAceLuma;                        // Maximum Luma for which ACE has to be applied
+} MHW_LACE_PARAMS, *PMHW_LACE_PARAMS;
+
+//!
+//! Structure MHW_COLORPIPE_PARAMS
+//! \brief IECP Parameters - Color Pipe
+//!
+typedef struct _MHW_COLORPIPE_PARAMS
+{
+    uint32_t            bActive;                    //!< Active or not
+    bool                bEnableACE;
+    bool                bEnableSTE;
+    bool                bEnableTCC;
+    bool                bAceLevelChanged;
+    uint32_t            dwAceLevel;
+    uint32_t            dwAceStrength;
+    bool                bEnableLACE;
+    MHW_STE_PARAMS      SteParams;
+    MHW_TCC_PARAMS      TccParams;
+    MHW_LACE_PARAMS     LaceParams;
+} MHW_COLORPIPE_PARAMS, *PMHW_COLORPIPE_PARAMS;
+
+//!
+//! \brief  Adaptive Contrast Enhancement (ACE) Params
+//!
+typedef struct _MHW_ACE_PARAMS
+{
+    uint32_t bActive;
+    uint16_t wACEPWLF_X[MHW_NUM_ACE_PWLF_COEFF];                                 //  Piece-wise linear function x
+    uint16_t wACEPWLF_Y[MHW_NUM_ACE_PWLF_COEFF];                                 //  Piece-wise linear function y
+    uint16_t wACEPWLF_S[MHW_NUM_ACE_PWLF_COEFF];                                 //  Piece-wise linear function slope
+    uint16_t wACEPWLF_B[MHW_NUM_ACE_PWLF_COEFF];                                 //  Piece-wise linear function bias
+} MHW_ACE_PARAMS, *PMHW_ACE_PARAMS;
+
+//!
+//! Structure MHW_PROCAMP_PARAMS
+//! \brief Procamp parameters
+//!
+typedef struct _MHW_PROCAMP_PARAMS
+{
+    uint32_t            bActive;                    //!< Active or not
+    bool                bEnabled;
+    uint32_t            brightness;
+    uint32_t            contrast;
+    uint32_t            sinCS;
+    uint32_t            cosCS;
+} MHW_PROCAMP_PARAMS, *PMHW_PROCAMP_PARAMS;
+
+//!
+//! Structure MHW_HOTPIXEL_PARAMS
+//! \brief Hotpixel Parameters
+//!
+typedef struct _MHW_HOTPIXEL_PARAMS
+{
+    uint32_t bActive;
+    uint32_t PixelThreshold;
+    uint32_t PixelCount;
+} MHW_HOTPIXEL_PARAMS, *PMHW_HOTPIXEL_PARAMS;
+
+//!
+//! Structure MHW_VIGNETTE_PARAMS
+//! \brief Vignette Parameters
+//!
+typedef struct _MHW_VIGNETTE_PARAMS
+{
+    uint32_t bActive;
+    uint32_t Width;
+    uint32_t Height;
+    uint32_t Stride;
+    uint8_t *pCorrectionMap;
+} MHW_VIGNETTE_PARAMS, *PMHW_VIGNETTE_PARAMS;
+
+//!
+//! Structure MHW_BLACK_LEVEL_PARAMS
+//! \brief Black Level Parameters
+//!
+typedef struct _MHW_BLACK_LEVEL_PARAMS
+{
+    uint32_t bActive;
+    uint32_t R;
+    uint32_t G0;
+    uint32_t B;
+    uint32_t G1;
+} MHW_BLACK_LEVEL_PARAMS, *PMHW_BLACK_LEVEL_PARAMS;
+
+//!
+//! Structure MHW_WB_MODE
+//! \brief WB Parameters
+//!
+typedef enum _MHW_WB_MODE
+{
+    MHW_WB_NONE,
+    MHW_WB_MANUAL,
+    MHW_WB_AUTO_IMAGE,
+    MHW_WB_COUNT
+} MHW_WB_MODE;
+
+//!
+//! Structure MHW_WHITE_BALANCE_PARAMS
+//! \brief White Balance Parameters
+//!
+typedef struct _MHW_WHITE_BALANCE_PARAMS
+{
+    uint32_t        bActive;
+    MHW_WB_MODE     Mode;
+    float           RedCorrection;
+    float           GreenTopCorrection;
+    float           BlueCorrection;
+    float           GreenBottomCorrection;
+} MHW_WHITE_BALANCE_PARAMS, *PMHW_WHITE_BALANCE_PARAMS;
+
+//!
+//! Structure MHW_COLOR_CORRECTION_PARAMS
+//! \brief Color Correction Parameters
+//!
+typedef struct _MHW_COLOR_CORRECTION_PARAMS
+{
+    uint32_t bActive;
+    float   CCM[3][3];
+} MHW_COLOR_CORRECTION_PARAMS, *PMHW_COLOR_CORRECTION_PARAMS;
+
+//!
+//! Structure MHW_FORWARD_GAMMA_SEG
+//! \brief Forward Gamma  SEG Parameters
+//!
+typedef struct _MHW_FORWARD_GAMMA_SEG
+{
+    uint16_t PixelValue;                                                         //!< SKL+ U16     Range=[0, 65535]
+    uint16_t RedChannelCorrectedValue;                                           //!< SKL+ U16     Range=[0, 65535]
+    uint16_t GreenChannelCorrectedValue;                                         //!< SKL+ U16     Range=[0, 65535]
+    uint16_t BlueChannelCorrectedValue;                                          //!< SKL+ U16     Range=[0, 65535]
+} MHW_FORWARD_GAMMA_SEG, *PMHW_FORWARD_GAMMA_SEG;
+
+//!
+//! Structure MHW_FWD_GAMMA_PARAMS
+//! \brief Forward Gamma Parameters
+//!
+typedef struct _MHW_FWD_GAMMA_PARAMS
+{
+    uint32_t                    bActive;
+    MHW_FORWARD_GAMMA_SEG       Segment[MHW_FORWARD_GAMMA_SEGMENT_COUNT];
+} MHW_FWD_GAMMA_PARAMS, *PMHW_FWD_GAMMA_PARAMS;
+
+//!
+//! Structure MHW_FECSC_PARAMS
+//! \brief Front End CSC Parameters
+//!
+typedef struct _MHW_FECSC_PARAMS
+{
+    uint32_t bActive;
+    float   PreOffset[3];
+    float   Matrix[3][3];
+    float   PostOffset[3];
+} MHW_FECSC_PARAMS, *PMHW_FECSC_PARAMS;
+
+//!
+//! Structure MHW_BECSC_PARAMS
+//! \brief Back End CSC Parameters
+//!
+typedef struct _MHW_BECSC_PARAMS
+{
+    uint32_t bActive;
+    float   PreOffset[3];
+    float   Matrix[3][3];
+    float   PostOffset[3];
+} MHW_BECSC_PARAMS, *PMHW_BECSC_PARAMS;
+
+//!
+//! Structure MHW_LGCA_PARAMS
+//! \brief  Geometric Lens Correction and Chorma Aberration  parameters
+//!
+typedef struct _MHW_LENS_CORRECTION_PARAMS
+{
+    uint32_t bActive;                    //!< Active or not
+    float   a[3];                       //!< Array (red, green, blue) of values for "a"
+    float   b[3];                       //!< Array (red, green, blue) of values for "b"
+    float   c[3];                       //!< Array (red, green, blue) of values for "c"
+    float   d[3];                       //!< Array (red, green, blue) of values for "d"
+} MHW_LENS_CORRECTION_PARAMS, *PMHW_LENS_CORRECTION_PARAMS;
+
+//!
+//! Structure MHW_ICC_COLOR_CONVERSION_PARAMS
+//! \brief  ICC Color Conversion
+//!
+typedef struct _MHW_ICC_COLOR_CONVERSION_PARAMS
+{
+    uint32_t bActive;                    //!< Active or not
+    uint32_t LUTSize;                    //!< Size (one dimensions) of the LUT
+    uint32_t LUTLength;                  //!< Length of the LUT, in unit of bit
+    uint8_t *pLUT;                       //!< Pointer to the LUT value
+} MHW_ICC_COLOR_CONVERSION_PARAMS, *PMHW_ICC_COLOR_CONVERSION_PARAMS;
+
+typedef struct _MHW_DEBAYER_PARAMS
+{
+    uint32_t BayerInput;                  //!< 0: MSB (default); 1: LSB
+    uint32_t LSBBayerBitDepth;            //!< 10, 12 or 14 for varies bayer input
+} MHW_DEBAYER_PARAMS, *PMHW_DEBAYER_PARAMS;
+
+//!
+//! Structure MHW_CAPPIPE_PARAMS
+//! \brief Capture Pipe Parameters
+//!
+typedef struct _MHW_CAPPIPE_PARAMS
+{
+    uint32_t                        bActive;
+    MHW_HOTPIXEL_PARAMS             HotPixelParams;
+    MHW_VIGNETTE_PARAMS             VignetteParams;
+    MHW_BLACK_LEVEL_PARAMS          BlackLevelParams;
+    MHW_WHITE_BALANCE_PARAMS        WhiteBalanceParams;
+    MHW_COLOR_CORRECTION_PARAMS     ColorCorrectionParams;
+    MHW_FWD_GAMMA_PARAMS            FwdGammaParams;
+    MHW_FECSC_PARAMS                FECSCParams;
+    MHW_BECSC_PARAMS                BECSCParams;
+    MHW_LENS_CORRECTION_PARAMS      LensCorrectionParams;
+    MHW_ICC_COLOR_CONVERSION_PARAMS ICCColorConversionParams;
+    MHW_DEBAYER_PARAMS              DebayerParams;
+} MHW_CAPPIPE_PARAMS, *PMHW_CAPPIPE_PARAMS;
+
+//!
+//! Structure MHW_3DLUT_PARAMS
+//! \details No pre-si version for MHW_VEBOX_IECP_PARAMS, just leave it now and handle it later
+//!
+typedef struct _MHW_3DLUT_PARAMS
+{
+    uint32_t bActive;                    //!< Active or not
+    uint32_t LUTSize;                    //!< Size (one dimensions) of the LUT
+    uint32_t LUTLength;                  //!< Length of the LUT, in unit of bit
+    uint8_t *pLUT;                       //!< Pointer to the LUT value
+} MHW_3DLUT_PARAMS, *PMHW_3DLUT_PARAMS;
+
+//!
+//! \brief  VEBOX HDR PARAMS
+//! \details For CCM settings, move 1DLut to here later
+typedef struct _MHW_1DLUT_PARAMS
+{
+    uint32_t bActive;
+    void     *p1DLUT;
+    uint32_t LUTSize;
+    int32_t *pCCM;
+    uint32_t CCMSize;
+} MHW_1DLUT_PARAMS, *PMHW_1DLUT_PARAMS;
+
+//!
+//! \brief  VEBOX IECP parameters
+//!
+typedef struct _MHW_VEBOX_IECP_PARAMS
+{
+    MHW_COLORPIPE_PARAMS            ColorPipeParams;
+    MHW_ACE_PARAMS                  AceParams;
+    MHW_PROCAMP_PARAMS              ProcAmpParams;
+    MHW_CAPPIPE_PARAMS              CapPipeParams;
+    MOS_FORMAT                      dstFormat;
+    MOS_FORMAT                      srcFormat;
+    MHW_CSPACE                      ColorSpace;                                 // ColorSpace of the input surface
+
+    // CSC params
+    bool                            bCSCEnable;                                 // Enable CSC transform
+    float                           *pfCscCoeff;                                // [3x3] CSC Coeff matrix
+    float                           *pfCscInOffset;                             // [3x1] CSC Input Offset matrix
+    float                           *pfCscOutOffset;                            // [3x1] CSC Output Offset matrix
+    bool                            bAlphaEnable;                               // Alpha Enable Param
+    uint16_t                        wAlphaValue;                                // Color Pipe Alpha Value
+
+    bool                            bAce;
+
+    MHW_3DLUT_PARAMS                s3DLutParams;
+    MHW_1DLUT_PARAMS                s1DLutParams;
+
+    // Front End CSC params
+    bool                            bFeCSCEnable;                               // Enable Front End CSC transform
+    float                           *pfFeCscCoeff;                              // [3x3] Front End CSC Coeff matrix
+    float                           *pfFeCscInOffset;                           // [3x1] Front End CSC Input Offset matrix
+    float                           *pfFeCscOutOffset;                          // [3x1] Front End CSC Output Offset matrix
+
+    // FDFB
+    bool                            iecpstateforFDFB;
+} MHW_VEBOX_IECP_PARAMS, *PMHW_VEBOX_IECP_PARAMS;
+
+//!
+//! \brief  VEBOX CH_DIR_FILTER_COEFFICIENT parameters
+//!
+typedef struct _MHW_VEBOX_CH_DIR_FILTER_COEFFICIENT
+{
+    uint32_t                        FilterCoefficient0;
+    uint32_t                        FilterCoefficient1;
+    uint32_t                        FilterCoefficient2;
+    uint32_t                        FilterCoefficient3;
+    uint32_t                        FilterCoefficient4;
+    uint32_t                        FilterCoefficient5;
+    uint32_t                        FilterCoefficient6;
+    uint32_t                        FilterCoefficient7;
+} MHW_VEBOX_CH_DIR_FILTER_COEFFICIENT, *PMHW_VEBOX_CH_DIR_FILTER_COEFFICIENT;
+
+//!
+//! \brief  VEBOX Scalar parameters
+//!
+typedef struct _MHW_VEBOX_SCALAR_PARAMS
+{
+    bool                                    bDisableChromaChannelDiagonalInterpolation;
+    MHW_VEBOX_CH_DIR_FILTER_COEFFICIENT     UVChCoefficient0;
+    MHW_VEBOX_CH_DIR_FILTER_COEFFICIENT     UVChCoefficient1;
+    MHW_VEBOX_CH_DIR_FILTER_COEFFICIENT     UVChCoefficient2;
+    MHW_VEBOX_CH_DIR_FILTER_COEFFICIENT     UVChCoefficient3;
+    uint32_t                                dwSADWT0;
+    uint32_t                                dwSADWT1;
+    uint32_t                                dwSADWT2;
+    uint32_t                                dwSADWT3;
+    uint32_t                                dwSADWT4;
+    uint32_t                                dwSADWT5;
+} MHW_VEBOX_SCALAR_PARAMS, *PMHW_VEBOX_SCALAR_PARAMS;
+
+//!
+//! \brief  VEBOX Gamut parameters
+//!
+typedef struct _MHW_VEBOX_GAMUT_PARAMS
+{
+    MHW_CSPACE                          ColorSpace;                             // ColorSpace of the input surface
+    MHW_CSPACE                          dstColorSpace;                          // ColorSpace of the output surface
+    MOS_FORMAT                          srcFormat;                              // Input surface format
+    MOS_FORMAT                          dstFormat;                              // output surface format
+    // GComp
+    MHW_GAMUT_MODE                      GCompMode;
+    // Basic mode params
+    uint32_t                            GCompBasicMode;
+    int32_t                             iBasicModeScalingFactor;
+    // Advanced mode params
+    int32_t                             iDin;
+    int32_t                             iDinDefault;
+    int32_t                             iDout;
+    int32_t                             iDoutDefault;
+
+    // GExp
+    MHW_GAMUT_MODE                      GExpMode;
+    uint32_t                            *pFwdGammaBias;
+    uint32_t                            *pInvGammaBias;
+    int32_t                             Matrix[3][3];
+
+    // Gamma correction
+    bool                                bGammaCorr;
+    MHW_GAMMA_VALUE                     InputGammaValue;
+    MHW_GAMMA_VALUE                     OutputGammaValue;
+
+    // HDR
+    bool                                bH2S;
+    uint16_t                            uiMaxCLL;
+
+    // FDFB
+    bool                                gamutstateforFDFB;
+
+    // Segmentation
+    bool                                bColorBalance;
+
+} MHW_VEBOX_GAMUT_PARAMS, *PMHW_VEBOX_GAMUT_PARAMS;
+
+//!
+//! \brief  Structure to handle VEBOX_DI_IECP_CMD Command
+//!
+typedef struct _MHW_VEBOX_DI_IECP_CMD_PARAMS
+{
+    uint32_t                            dwEndingX;
+    uint32_t                            dwStartingX;
+    uint32_t                            dwEndingY;
+    uint32_t                            dwStartingY;
+    uint32_t                            dwCurrInputSurfOffset;
+    uint32_t                            dwPrevInputSurfOffset;
+    uint32_t                            dwCurrOutputSurfOffset;
+    uint32_t                            dwStreamID;                         // Stream ID for input surface
+    uint32_t                            dwStreamIDOutput;                   // Stream ID for output surface
+
+    PMOS_RESOURCE                       pOsResCurrInput;
+    PMOS_RESOURCE                       pOsResPrevInput;
+    PMOS_RESOURCE                       pOsResStmmInput;
+    PMOS_RESOURCE                       pOsResStmmOutput;
+    PMOS_RESOURCE                       pOsResDenoisedCurrOutput;
+    PMOS_RESOURCE                       pOsResCurrOutput;
+    PMOS_RESOURCE                       pOsResPrevOutput;
+    PMOS_RESOURCE                       pOsResStatisticsOutput;
+    PMOS_RESOURCE                       pOsResAlphaOrVignette;
+    PMOS_RESOURCE                       pOsResLaceOrAceOrRgbHistogram;
+    PMOS_RESOURCE                       pOsResSkinScoreSurface;
+
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    CurrInputSurfCtrl;//can be removed after VPHAL moving to new cmd definition
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    PrevInputSurfCtrl;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    StmmInputSurfCtrl;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    StmmOutputSurfCtrl;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    DenoisedCurrOutputSurfCtrl;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    CurrOutputSurfCtrl;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    PrevOutputSurfCtrl;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    StatisticsOutputSurfCtrl;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    AlphaOrVignetteSurfCtrl;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    LaceOrAceOrRgbHistogramSurfCtrl;
+    MHW_MEMORY_OBJECT_CONTROL_PARAMS    SkinScoreSurfaceSurfCtrl;
+
+    MOS_MEMCOMP_STATE                   CurInputSurfMMCState;
+} MHW_VEBOX_DI_IECP_CMD_PARAMS, *PMHW_VEBOX_DI_IECP_CMD_PARAMS;
+
+//!
+//! \brief  Structure to VEBOX SURFACE PARAMETERS for VEBOX_SURFACE_STATE_CMD Command
+//!
+typedef struct _MHW_VEBOX_SURFACE_PARAMS
+{
+    uint32_t                    bActive             = 0;
+    bool                        bIsCompressed       = false;
+    MOS_FORMAT                  Format              = Format_None;       //!<  Surface format
+    MOS_RESOURCE_MMC_MODE       CompressionMode     = MOS_MMC_DISABLED;  //!<  Surface Compression Mode
+    uint32_t                    dwCompressionFormat = 0;     //!<  Surface Compression Format
+    uint32_t                    dwWidth             = 0;     //!<  Surface width
+    uint32_t                    dwHeight            = 0;     //!<  Surface height
+    uint32_t                    dwPitch             = 0;     //!<  Surface pitch
+    uint32_t                    dwBitDepth          = 0;     //!<  Surface bitdepth
+    uint32_t                    dwStreamID          = 0;     //!<  Surface StreamID
+    uint32_t                    dwYoffset           = 0;     //!<  Surface Yoffset in Vertical
+    uint32_t                    dwUYoffset          = 0;     //!<  Surface Uoffset in Vertical
+    uint32_t                    dwOffset            = 0;     //!<  Surface Offset from Start Point
+    MOS_TILE_TYPE               TileType            = MOS_TILE_X;           //!<  Tile Type
+    MOS_TILE_MODE_GMM           TileModeGMM         = MOS_TILE_LINEAR_GMM;  //!<  Tile Mode from GMM Definition
+    bool                        bGMMTileEnabled     = false;         //!<  GMM defined tile mode flag
+    RECT                        rcSrc               = {0, 0, 0, 0};  //!< Source rectangle
+    RECT                        rcMaxSrc            = {0, 0, 0, 0};  //!< Max source rectangle
+    bool                        bVEBOXCroppingUsed  = false;         //!<Vebox crop case need use rcSrc as vebox input.
+    PMOS_RESOURCE               pOsResource         = nullptr;            //!<  Surface resource
+} MHW_VEBOX_SURFACE_PARAMS, *PMHW_VEBOX_SURFACE_PARAMS;
+
+//!
+//! \brief  Structure to handle VEBOX_SURFACE_STATE_CMD Command
+//!
+typedef struct _MHW_VEBOX_SURFACE_STATE_CMD_PARAMS
+{
+    MHW_VEBOX_SURFACE_PARAMS         SurfInput    = {};
+    MHW_VEBOX_SURFACE_PARAMS         SurfOutput   = {};
+    MHW_VEBOX_SURFACE_PARAMS         SurfSTMM     = {};
+    MHW_VEBOX_SURFACE_PARAMS         SurfDNOutput = {};
+    MHW_VEBOX_SURFACE_PARAMS         SurfSkinScoreOutput = {};
+    bool                             bDIEnable    = false;
+    bool                             b3DlutEnable = false;
+    bool                             bOutputValid = false;
+} MHW_VEBOX_SURFACE_STATE_CMD_PARAMS, *PMHW_VEBOX_SURFACE_STATE_CMD_PARAMS;
+
+//!
+//! \brief  VEBOX input surface control bits params
+//!
+typedef struct _MHW_VEBOX_SURFACE_CNTL_PARAMS
+{
+    bool                            bIsCompressed;
+    MOS_RESOURCE_MMC_MODE           CompressionMode;
+} MHW_VEBOX_SURFACE_CNTL_PARAMS, *PMHW_VEBOX_SURFACE_CNTL_PARAMS;
+
+//!
+//! \brief  VEBOX Heap State Structure
+//!
+typedef struct _MHW_VEBOX_HEAP_STATE
+{
+    bool        bBusy;                                      // true if the state is in use (must sync before use)
+    uint32_t    dwSyncTag;                                  // Vebox heap state sync tag
+} MHW_VEBOX_HEAP_STATE, *PMHW_VEBOX_HEAP_STATE;
+
+//!
+//! \brief  VEBOX Heap Structure
+//!
+typedef struct _MHW_VEBOX_HEAP
+{
+    uint32_t                uiCurState;                                         // Current VEBOX State
+    uint32_t                uiNextState;                                        // Next VEBOX State
+    uint32_t                uiOffsetSync;                                       // Offset of sync data in VeboxHeap
+    uint32_t                uiDndiStateOffset;                                  // DNDI or Scalar state offset
+    uint32_t                uiIecpStateOffset;                                  // IECP state offset
+    uint32_t                uiGamutStateOffset;                                 // Gamut state offset
+    uint32_t                uiVertexTableOffset;                                // Vertex Table offset
+    uint32_t                uiCapturePipeStateOffset;                           // Capture Pipe state offset
+    uint32_t                uiGammaCorrectionStateOffset;                       // Gamma Correction state offset
+    uint32_t                uiHdrStateOffset;                                   // Hdr State offset
+    uint32_t                uiInstanceSize;                                     // Size of single instance of VEBOX states
+    uint32_t                uiStateHeapSize;                                    // Total size of VEBOX States heap
+    PMHW_VEBOX_HEAP_STATE   pStates;                                            // Array of VEBOX Heap States
+    MOS_RESOURCE            DriverResource;                                     // Graphics memory for Driver access
+    MOS_RESOURCE            KernelResource;                                     // Graphics memory for Kernel access
+    uint8_t                 *pLockedDriverResourceMem;                           // Locked Driver resource memory
+
+    // Synchronization
+    volatile uint32_t       *pSync;                                              // Pointer to sync area (when locked)
+    uint32_t                dwNextTag;                                          // Next sync tag value to use
+    uint32_t                dwSyncTag;                                          // Last sync tag completed
+} MHW_VEBOX_HEAP, *PMHW_VEBOX_HEAP;
+
+//!
+//! \brief  VEBOX settings Structure
+//!
+typedef struct
+{
+    uint32_t            uiNumInstances;                                         // Number of VEBOX instances to create
+    uint32_t            uiSyncSize;                                             // Sync Data Size
+    uint32_t            uiDndiStateSize;                                        // DNDI State Size
+    uint32_t            uiIecpStateSize;                                        // IECP State Size
+    uint32_t            uiGamutStateSize;                                       // Gamut State Size
+    uint32_t            uiVertexTableSize;                                      // Vertex Table Size
+    uint32_t            uiCapturePipeStateSize;                                 // Capture Pipe State Size (Gen8+)
+    uint32_t            uiGammaCorrectionStateSize;                             // Gamma Correction State Size (Gen9+)
+    uint32_t            uiHdrStateSize;                                         // HDR State Size
+} MHW_VEBOX_SETTINGS, *PMHW_VEBOX_SETTINGS;
+typedef const MHW_VEBOX_SETTINGS CMHW_VEBOX_SETTINGS, *PCMHW_VEBOX_SETTINGS;
+
+//!
+//! \brief  MHW VEBOX GPUNODE Structure
+//!
+typedef struct _MHW_VEBOX_GPUNODE_LIMIT
+{
+    bool    bSfcInUse;
+    bool    bCpEnabled;
+    uint32_t dwGpuNodeToUse;
+} MHW_VEBOX_GPUNODE_LIMIT, *PMHW_VEBOX_GPUNODE_LIMIT;
+
+
+
+class MhwVeboxInterface
+{
+public:
+    virtual ~MhwVeboxInterface()
+    {
+        MHW_FUNCTION_ENTER;
+    }
+
+    //!
+    //! \brief      Add VEBOX Vertex Table
+    //! \details    Add Vebox vertex table based on color space
+    //! \param      [in] ColorSpace
+    //!             ColorSpace of the source surface
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddVeboxVertexTable(
+        MHW_CSPACE                              ColorSpace) = 0;
+
+    //!
+    //! \brief    Add Vebox State
+    //! \details  Add Vebox State commands
+    //! \param    [in] pCmdBuffer
+    //!           Pointer to Command Buffer
+    //! \param    [in] pVeboxStateCmdParams
+    //!           Pointer to Vebox State Params
+    //! \return   MOS_STATUS
+    //!
+    virtual MOS_STATUS AddVeboxState(
+        PMOS_COMMAND_BUFFER                     pCmdBuffer,
+        PMHW_VEBOX_STATE_CMD_PARAMS             pVeboxStateCmdParams,
+        bool                                    bUseCmBuffer) = 0;
+
+    //!
+    //! \brief      Send Vebox Surface State commands
+    //! \details    Set surface state for input and output surfaces
+    //! \param      [in] pCmdBuffer
+    //!             Pointer to command buffer
+    //! \param      [in] pVeboxSurfaceStateCmdParams
+    //!             Pointer to surface state params
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddVeboxSurfaces(
+        PMOS_COMMAND_BUFFER                     pCmdBuffer,
+        PMHW_VEBOX_SURFACE_STATE_CMD_PARAMS     pVeboxSurfaceStateCmdParams) = 0;
+
+    //!
+    //! \brief    Send Vebox Di Iecp
+    //! \details  Send Vebox DI IECP commands
+    //! \param    [in] pCmdBuffer
+    //!           Pointer to Command Buffer
+    //! \param    [in] pVeboxDiIecpCmdParams
+    //!           Pointer to DI IECP Params
+    //! \return   MOS_STATUS
+    //!
+    virtual MOS_STATUS AddVeboxDiIecp(
+        PMOS_COMMAND_BUFFER                     pCmdBuffer,
+        PMHW_VEBOX_DI_IECP_CMD_PARAMS           pVeboxDiIecpCmdParams) = 0;
+
+    //!
+    //! \brief      Add VEBOX DNDI States
+    //! \details    Add vebox dndi states
+    //! \param      [in] pVeboxDndiParams
+    //!             Pointer to VEBOX DNDI State Params
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddVeboxDndiState(
+        PMHW_VEBOX_DNDI_PARAMS                  pVeboxDndiParams) = 0;
+
+    //!
+    //! \brief      Add VEBOX Gamut States
+    //! \details    Add Vebox Gamut states
+    //! \param      [in] pVeboxIecpParams
+    //!             Pointer to VEBOX IECP State Params
+    //! \param      [in] pVeboxGamutParams
+    //!             Pointer to VEBOX Gamut State Params
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddVeboxGamutState(
+        PMHW_VEBOX_IECP_PARAMS                  pVeboxIecpParams,
+        PMHW_VEBOX_GAMUT_PARAMS                 pVeboxGamutParams) = 0;
+
+    virtual MOS_STATUS AddVeboxHdrState(PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams) { return MOS_STATUS_SUCCESS;}
+
+    //!
+    //! \brief      Add VEBOX IECP States
+    //! \details    Add Vebox IECP states STD/E, ACE, TCC, FECSC, BLC, ProcAmp, also add CapPipe state
+    //! \param      [in, out] pVeboxIecpParams
+    //!             Pointer to VEBOX IECP State Params
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddVeboxIecpState(
+        PMHW_VEBOX_IECP_PARAMS                  pVeboxIecpParams) = 0;
+
+    //!
+    //! \brief      Add VEBOX IECP ACE State
+    //! \details    Add vebox IECP  ACE State
+    //! \param      [in] pVeboxIecpParams
+    //!             Pointer to VEBOX IECP State Params
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS AddVeboxIecpAceState(
+        PMHW_VEBOX_IECP_PARAMS                  pVeboxIecpParams) = 0;
+
+    //!
+    //! \brief      Vebox adjust boundary
+    //! \details    Adjust the width and height of the surface for Vebox
+    //! \param      [in] pSurfaceParam
+    //!             pointer to input Surface
+    //! \param      [out] pdwSurfaceWidth
+    //!             Adjusted surface width
+    //! \param      [out] pdwSurfaceHeight
+    //!             Adjusted surface height
+    //! \param      [in] bDIEnable
+    //!             identify if DI is enabled
+    //! \return     MOS_STATUS
+    //!
+    virtual MOS_STATUS VeboxAdjustBoundary(
+        PMHW_VEBOX_SURFACE_PARAMS               pSurfaceParam,
+        uint32_t                                *pdwSurfaceWidth,
+        uint32_t                                *pdwSurfaceHeight,
+        bool                                    bDIEnable) = 0;
+
+    //! \brief      Get Full Image Histogram
+    //! \details    Get VEBOX IECP ACE State inforation about Full Image Histogram
+    //! \param      [in, out] pFullImageHistogram
+    //!             Pointer to Full Image Histogram Param
+    //! \return     MOS_STATUS
+    //!             MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS GetVeboxAce_FullImageHistogram(
+        uint32_t                                *pFullImageHistogram)
+    {
+        MOS_STATUS eStatus = MOS_STATUS_UNKNOWN;
+        return eStatus;
+    }
+    //!
+    //! \brief    Add Vebox Surface Controls Bits
+    //! \details  Add Vebox Surface Control Bits for input surface
+    //! \param    [in] pVeboxSurfCntlParams
+    //!           Pointer to VEBOX Surface control parameters
+    //! \param    [out] pSurfCtrlBits
+    //!           Pointer to surface control bits
+    //! \return   MOS_STATUS
+    //!
+    virtual MOS_STATUS AddVeboxSurfaceControlBits(
+        PMHW_VEBOX_SURFACE_CNTL_PARAMS          pVeboxSurfCntlParams,
+        uint32_t                                *pSurfCtrlBits) = 0;
+
+    //!
+    //! \brief    Add Vebox Tiling Convert Control Bits
+    //! \details  Add Vebox Tiling Convert Control Bits
+    //! \param    [in] cmdBuffer
+    //!           Pointers to the HW Cmd buffer
+    //! \param    [in] inSurParams
+    //!           Pointer to input vebox surface params
+    //! \param    [in] outSurParams
+    //!           Pointer to output vebox surface params
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    virtual MOS_STATUS AddVeboxTilingConvert(
+        PMOS_COMMAND_BUFFER cmdBuffer,
+        PMHW_VEBOX_SURFACE_PARAMS        inSurParams,
+        PMHW_VEBOX_SURFACE_PARAMS        outSurParams) = 0;
+
+    //!
+    //! \brief    Decide Which GPU Node to use for Vebox
+    //! \details  Client facing function to create gpu context used by Vebox
+    //! \param    [out] pVEGpuNodeLimit
+    //!           VEGpuNode Limitation
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS FindVeboxGpuNodeToUse(
+        PMHW_VEBOX_GPUNODE_LIMIT                pVeboxGpuNodeLimit)
+    {
+        MOS_GPU_NODE VeboxGpuNode = MOS_GPU_NODE_VE;
+        MOS_STATUS   eStatus = MOS_STATUS_SUCCESS;
+
+        MHW_CHK_NULL(pVeboxGpuNodeLimit);
+
+        pVeboxGpuNodeLimit->dwGpuNodeToUse = VeboxGpuNode;
+
+    finish:
+        return eStatus;
+   }
+
+    //!
+    //! \brief    Create Gpu Context for Vebox
+    //! \details  Create Gpu Context for Vebox
+    //! \param    [in] pOsInterface
+    //!           OS interface
+    //! \param    [in] VeboxGpuContext
+    //!           Vebox Gpu Context
+    //! \param    [in] VeboxGpuNode
+    //!           Vebox Gpu Node
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS CreateGpuContext(
+        PMOS_INTERFACE  pOsInterface,
+        MOS_GPU_CONTEXT VeboxGpuContext,
+        MOS_GPU_NODE    VeboxGpuNode)
+    {
+        MOS_GPUCTX_CREATOPTIONS createOption;
+        MOS_STATUS              eStatus = MOS_STATUS_SUCCESS;
+
+        MHW_CHK_NULL(pOsInterface);
+
+        MHW_CHK_STATUS(pOsInterface->pfnCreateGpuContext(
+            pOsInterface,
+            VeboxGpuContext,
+            VeboxGpuNode,
+            &createOption));
+
+    finish:
+        return eStatus;
+    }
+
+    virtual MOS_STATUS setVeboxPrologCmd(
+        PMHW_MI_INTERFACE   mhwMiInterface,
+        PMOS_COMMAND_BUFFER cmdBuffer) = 0;
+
+    virtual MOS_STATUS Add1DLutState(void *&surface, PMHW_1DLUT_PARAMS p1DLutParams) { return MOS_STATUS_SUCCESS; }
+
+    //!
+    //! \brief    Get new vebox interface, temporal solution before switching from
+    //!           old interface to new one
+    //!
+    //! \return   pointer to new render interface
+    //!
+    virtual std::shared_ptr<void> GetNewVeboxInterface() { return nullptr; }
+
+protected:
+    MhwVeboxInterface(PMOS_INTERFACE pOsInterface);
+
+    //!
+    //! \brief    Trace indirect state info by OCA
+    //! \details  Trace which resource being used to store indirect state by OCA.
+    //! \param    [in] cmdBuffer
+    //!           Command buffer of current vebox workload.
+    //! \param    [in] mosContext
+    //!           mos context
+    //! \param    [in] isCmBuffer
+    //!           true if CM buffer being used for indirect state, otherwise, vebox heap is used.
+    //! \param    [in] useVeboxHeapKernelResource
+    //!           true if kernel copy needed for indirect state.
+    //! \return   void
+    //!
+    void TraceIndirectStateInfo(MOS_COMMAND_BUFFER &cmdBuffer, MOS_CONTEXT &mosContext, bool isCmBuffer, bool useVeboxHeapKernelResource);
+
+public:
+    //!
+    //! \brief    Adds a resource to the command buffer or indirect state (SSH)
+    //! \details  Internal MHW function to add either a graphics address of a resource or
+    //!           add the resource to the patch list for the requested buffer or state
+    //! \param    [in] pOsInterface
+    //!           OS interface
+    //! \param    [in] pCmdBuffer
+    //!           If adding a resource to the command buffer, the buffer to which the resource
+    //!           is added
+    //! \param    [in] pParams
+    //!           Parameters necessary to add the graphics address
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS(*pfnAddResourceToCmd)(
+        PMOS_INTERFACE                          pOsInterface,
+        PMOS_COMMAND_BUFFER                     pCmdBuffer,
+        PMHW_RESOURCE_PARAMS                    pParams);
+
+    //! \brief VEBOX Heap management functions
+    //!
+    //! \brief    Create Vebox Heap
+    //! \details  Create Vebox Heap
+    //!     VPHAL_VEBOX (CPU)
+    //!      -------------------
+    //!     | DriverResource    |
+    //!      -------------------
+    //!     | KernelResource    |
+    //!      -------------------
+    //!
+    //!      GPU (Driver Resource)      GPU (Kernel Resource)        VEBOX State (in Graphics Memory)
+    //!      -------------------         -------------------        ---------------------
+    //!     | VEBOX State 0     |       | VEBOX State 0     |       | DNDI State         |
+    //!      -------------------         -------------------         --------------------
+    //!     | VEBOX State 1     |       | VEBOX State 1     |       | IECP State         |
+    //!      -------------------         -------------------         --------------------
+    //!     | VEBOX State N     |       | VEBOX State N     |       | Gamut              |
+    //!      -------------------         -------------------         --------------------
+    //!     | VEBOX Sync Data   |       | VEBOX Sync Data   |       | Vertex State       |
+    //!      -------------------                                     --------------------
+    //!                                                             | CapturePipe State  |
+    //!                                                              --------------------
+    //!                                                             | Gamma Correction State |
+    //!                                                              ------------------------
+    //!                                                             | HDR State              |
+    //!                                                              ------------------------
+    //! \return   MOS_STATUS
+    //!
+    MOS_STATUS CreateHeap();
+
+    //!
+    //! \brief    Destroy Vebox Heap
+    //! \details  Destroy Vebox Heap
+    //! \return   MOS_STATUS
+    //!
+    MOS_STATUS DestroyHeap();
+
+    //!
+    //! \brief    Assign Vebox State
+    //! \details  Gets a pointer to the next available vebox heap instance
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS: if vebox heap avalible, sets pVeboxHeap->uiCurState
+    //!                 pointer to avalible vebox heap instance index and clear
+    //!                 bBusy flag for it
+    //!           MOS_STATUS_UNKNOWN: invalid, no available vebox heap instance available + timeout
+    //!
+    MOS_STATUS AssignVeboxState();
+
+    //!
+    //! \brief    Get Vebox Heap Information
+    //! \details  Get Vebox Heap pointer to access Vebox Heap information
+    //! \param    [out] ppVeboxHeap
+    //!           Pointer to const Vebox Heap Structure
+    //! \return   MOS_STATUS
+    //!
+    MOS_STATUS GetVeboxHeapInfo(
+        const MHW_VEBOX_HEAP                    **ppVeboxHeap);
+
+    //!
+    //! \brief    Update Vebox Sync tag info
+    //! \details  Update Vebox Heap Sync tag info
+    //! \return   MOS_STATUS
+    //!
+    MOS_STATUS UpdateVeboxSync();
+
+    //!
+    //! \brief    Set which vebox can be used by HW
+    //! \details  VPHAL set which VEBOX can be use by HW
+    //! \param    [in] dwVeboxIndex
+    //!           set which Vebox can be used by HW
+    //! \param    [in] dwVeboxCount
+    //!           set Vebox Count
+    //! \param    [in] dwUsingSFC
+    //!           set whether using SFC
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    virtual MOS_STATUS SetVeboxIndex(
+        uint32_t dwVeboxIndex,
+        uint32_t dwVeboxCount,
+        uint32_t dwUsingSFC)
+    {
+        MOS_UNUSED(dwVeboxIndex);
+        MOS_UNUSED(dwVeboxCount);
+        MOS_UNUSED(dwUsingSFC);
+        return MOS_STATUS_SUCCESS;
+    }
+
+private:
+    //!
+    //! \brief    Refresh Vebox Sync
+    //! \details  Update Vebox Heap Sync tags and clear bBusy flag in availble
+    //!           pVeboxHeap->pStates
+    //! \return   void
+    //!
+    void RefreshVeboxSync();
+
+    //! \brief    Vebox heap instance in use
+    int                    m_veboxHeapInUse = 0;
+
+ public:
+    PMOS_INTERFACE         m_osInterface   = nullptr;
+    PMHW_VEBOX_HEAP        m_veboxHeap     = nullptr;
+    MHW_VEBOX_SETTINGS     m_veboxSettings;
+    bool                   m_veboxScalabilitywith4K    = false;
+    std::shared_ptr<void>  m_veboxItfNew    = nullptr;
+};
+
+#endif // __MHW_VEBOX_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/vdbox/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/hw/vdbox/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/vdbox/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/vdbox/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2021, Intel Corporation
+# Copyright (c) 2021-2022, Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -23,16 +23,14 @@ set(TMP_HEADERS_
     ${CMAKE_CURRENT_LIST_DIR}/mhw_vdbox_huc_def.h
 )
 
-set(HEADERS_
-    ${HEADERS_}
-    ${TMP_HEADERS_}
-)
-
-set(COMMON_HEADERS_
-    ${COMMON_HEADERS_}
+set(SOFTLET_COMMON_HEADERS_
+    ${SOFTLET_COMMON_HEADERS_}
     ${TMP_HEADERS_}
 )
 
 source_group( "MHW\\Vdbox" FILES ${TMP_HEADERS_} )
 
-media_add_curr_to_include_path()
\ No newline at end of file
+set(SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_
+    ${SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/hw/vdbox/mhw_vdbox.h 22.5.1+ds1-1/media_common/agnostic/common/hw/vdbox/mhw_vdbox.h
--- 22.4.3+ds1-1/media_common/agnostic/common/hw/vdbox/mhw_vdbox.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/hw/vdbox/mhw_vdbox.h	2022-07-19 15:03:31.000000000 +0000
@@ -265,6 +265,10 @@ struct MHW_VDBOX_PIPE_MODE_SELECT_PARAMS
     bool                        bStreamObjectUsed = false;
     // No need to set protection settings
     bool                        disableProtectionSetting = false;
+
+    MHW_VDBOX_HCP_PIPE_WORK_MODE      PipeWorkMode    = MHW_VDBOX_HCP_PIPE_WORK_MODE_LEGACY;
+    MHW_VDBOX_HCP_MULTI_ENGINE_MODE   MultiEngineMode = MHW_VDBOX_HCP_MULTI_ENGINE_MODE_FE_LEGACY;
+
     virtual ~MHW_VDBOX_PIPE_MODE_SELECT_PARAMS() {}
 };
 using PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS = MHW_VDBOX_PIPE_MODE_SELECT_PARAMS * ;
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces.h 22.5.1+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces.h
--- 22.4.3+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2013-2019, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     media_interfaces.h
+//! \brief    Helps with gen-specific factory creation.
+//!
+
+#ifndef __MEDIA_INTERFACES_H__
+#define __MEDIA_INTERFACES_H__
+
+#include <map>
+#include "mos_utilities.h"
+
+//!
+//! \class    MediaInterfacesFactory
+//! \brief    Media interfaces factory
+//!
+template <class T>
+class MediaInterfacesFactory
+{
+public:
+    typedef T *Type;
+    typedef uint32_t KeyType;
+    typedef Type (*Creator)();
+    typedef std::map<KeyType, Creator>  Creators;
+    typedef typename Creators::iterator Iterator;
+
+    //!
+    //! \brief    register one Class C with key.
+    //! \details  Use the member template to register class C with key and C is the
+    //!           derived class of base class T.
+    //!
+    //! \param    [in] key
+    //!           KeyType, the type alias of uint32_t.
+    //!
+    //! \param    [in] forceReplace
+    //!           if force to replace the exsiting Creator, default is false.
+    //!
+    //! \return   true is returned if class C is successfully registerted with key
+    //!           false is returned if key is already registered and doesn't register
+    //!           class C with key.
+    //!
+    template <class C>
+    static bool RegisterHal(KeyType key, bool forceReplace = false)
+    {
+        Creators &creators = GetCreators();
+        Iterator creator = creators.find(key);
+        if (creator == creators.end())
+        {
+            std::pair<Iterator, bool> result =
+                GetCreators().insert(std::make_pair(key, Create<C>));
+            return result.second;
+        }
+        else
+        {
+            if (forceReplace)
+            {
+                creators.erase(creator);
+                std::pair<Iterator, bool> result =
+                    GetCreators().insert(std::make_pair(key, Create<C>));
+                return result.second;
+            }
+            return true;
+        }
+    }
+
+    //!
+    //! \brief    create a new object that is registered with key.
+    //! \details  create and return one new object that is registered with key. And Args is passed to create
+    //!           the new object.
+    //!
+    //! \param    [in] key
+    //!           KeyType, the type alias of uint32_t.
+    //!
+    //! \return   the derived object of T is returned if key is found and the object is created.
+    //!           nullptr is returned if key is not found
+    //!
+    static Type CreateHal(
+        KeyType key)
+    {
+        Creators &creators = GetCreators();
+        Iterator creator = creators.find(key);
+        if (creator != creators.end())
+        {
+            return (creator->second)();
+        }
+
+        return nullptr;
+    }
+
+private:
+
+    //!
+    //! \brief    the callback function with key.
+    //! \details  The member template to create the derived object
+    //!
+    //! \param    [in] arg
+    //!           ArgType, the type alias of class template parameter.
+    //!
+    //! \return   the created object with arg input for C constructor.
+    //!
+    template <class C>
+    static Type Create()
+    {
+        return MOS_New(C);
+    }
+
+
+    //!
+    //! \brief    obtain the static pair table of param@ key and callback function
+    //! \details  obtain the static pair table that is registerted with param@key and callback function
+    //!
+    //! \return   return the static pair table about the param @key and callback function
+    static Creators &GetCreators()
+    {
+        static Creators creators;
+
+        return creators;
+    }
+};
+
+#define MEDIA_EXT_FLAG  0x10000000
+
+#endif // __MEDIA_INTERFACES_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_hwinfo_device.h 22.5.1+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_hwinfo_device.h
--- 22.4.3+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_hwinfo_device.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_hwinfo_device.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2021, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     media_interfaces_hwinfo_device.h
+//! \brief    Gen-specific factory creation of the hwinfo device interfaces
+//!
+
+#ifndef __MEDIA_INTERFACES_HWINFO_DEVICE_H__
+#define __MEDIA_INTERFACES_HWINFO_DEVICE_H__
+
+#include "media_interfaces.h"
+#include "media_interfaces_hwinfo.h"
+#include "igfxfmid.h"
+
+#define IP_VERSION_UNKNOW 0
+
+class MediaInterfacesHwInfo;
+
+//!
+//! \class    HwInfo
+//! \brief    Save hw information
+//!
+
+class MediaInterfacesHwInfoDevice
+{
+public:
+    virtual ~MediaInterfacesHwInfoDevice() { }
+
+    MediaInterfacesHwInfo m_hwInfo;
+    //!
+    //! \brief    Create hw info
+    //! \param    [in] productFamily
+    //!           Product family.
+    //!
+    //! \return   Pointer to Gen specific hw info if
+    //!           successful, otherwise return nullptr
+    //!
+    static MediaInterfacesHwInfo *CreateFactory(PLATFORM platform, MEDIA_WA_TABLE *waTable = nullptr);
+
+    //!
+    //! \brief    Refresh RevId
+    //! \return   MOS_STATUS_SUCCESS if succeeded, else error code.
+    //!
+    virtual MOS_STATUS RefreshRevId(PLATFORM &platform, MEDIA_WA_TABLE *waTable)
+    {
+        return MOS_STATUS_SUCCESS;
+    };
+
+    //!
+    //! \brief    Initializes platform specific hw type
+    //! \return   MOS_STATUS_SUCCESS if succeeded, else error code.
+    //!
+    virtual MOS_STATUS Initialize(PLATFORM platform)
+    {
+        m_hwInfo.SetDeviceInfo(IP_VERSION_UNKNOW, 0);
+        return MOS_STATUS_SUCCESS;
+    };
+
+};
+
+extern template class MediaInterfacesFactory<MediaInterfacesHwInfoDevice>;
+
+#endif // __MEDIA_INTERFACES_HWINFO_DEVICE_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_renderhal.h 22.5.1+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_renderhal.h
--- 22.4.3+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_renderhal.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_renderhal.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2013-2017, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     media_interfaces_renderhal.h
+//! \brief    Gen-specific factory creation of the renderhal interfaces
+//!
+
+#ifndef __MEDIA_INTERFACES_RENDERHAL_H__
+#define __MEDIA_INTERFACES_RENDERHAL_H__
+
+#include "media_interfaces.h"
+#include "renderhal_platform_interface.h"
+
+//!
+//! \class    RenderHalDevice
+//! \brief    Render hal device
+//!
+class RenderHalDevice
+{
+public:
+    virtual ~RenderHalDevice() {}
+
+    //!
+    //! \brief    Create Platform-related interfaces in Render Hal
+    //! \details  Entry point to create Platform-related interfaces in Render Hal
+    //! \param    [in] osInterface
+    //!           Pointer to the MOS interfaces
+    //! \return   Pointer to Platform-related interfaces in Render Hal
+    //!
+    static XRenderHal_Platform_Interface* CreateFactory(
+                                    PMOS_INTERFACE osInterface);
+
+protected:
+    //!
+    //! \brief    Initializes platform specific Render Hal interfaces
+    //! \return   MOS_STATUS_SUCCESS if succeeded, else error code.
+    //!
+    virtual MOS_STATUS Initialize() = 0;
+
+    XRenderHal_Platform_Interface *m_renderhalDevice = nullptr;
+};
+
+extern template class MediaInterfacesFactory<RenderHalDevice>;
+
+#endif // __MEDIA_INTERFACES_RENDERHAL_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_vphal.h 22.5.1+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_vphal.h
--- 22.4.3+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_vphal.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/media_interfaces/media_interfaces_vphal.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2017-2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     media_interfaces_vphal.h
+//! \brief    Gen-specific factory creation of the vphal interfaces
+//!
+
+#ifndef __MEDIA_INTERFACES_VPHAL_H__
+#define __MEDIA_INTERFACES_VPHAL_H__
+
+#include "media_interfaces.h"
+#include "vp_base.h"
+#include "vp_utils.h"
+
+namespace vp
+{
+class VpPipeline;
+class VpPlatformInterface;
+};
+
+//!
+//! \class    VphalDevice
+//! \brief    Vphal device
+//!
+class VphalDevice
+{
+public:
+    virtual ~VphalDevice() {}
+
+    VpBase                  *m_vphalState           = nullptr;  //!< VpHal State created for specific gen.
+    VpBase                  *m_vpBase               = nullptr;
+    bool                    m_isNextEnabled         = false;
+    vp::VpPipeline          *m_vpPipeline           = nullptr;  //!< vp pipeline created for specific gen, which is used for sfc service.
+    vp::VpPlatformInterface *m_vpPlatformInterface  = nullptr;  //!< platform interface created for specific gen, which is used for sfc service.
+
+    //!
+    //! \brief    Creates the VpHal device.
+    //! \details  Allocates all interfaces necessary for VpHal to function in the requested configuration and sets up all function pointers.
+    //! \param    [in] osInterface
+    //!           If an OS interface already exists, it may be passed in here for use by the VpHal device, if not, one is created.
+    //! \param    [in] osDriverContext
+    //!           OS context used by to initialize the MOS_INTERFACE, includes information necessary for resource management and interfacing with KMD in general
+    //! \param    [out] eStatus
+    //!           MOS_STATUS, return MOS_STATUS_SUCCESS if successful, otherwise failed.
+    //! \return   VpBase*
+    //!           returns a valid pointer if successful and nullptr if failed.
+    //!
+    static VpBase* CreateFactory(
+        PMOS_INTERFACE  osInterface,
+        PMOS_CONTEXT    osDriverContext,
+        MOS_STATUS      *eStatus);
+    //!
+    //! \brief    Creates the VpHal device.
+    //! \details  Allocates all interfaces necessary for VpHal to function in the requested configuration and sets up all function pointers.
+    //! \param    [in] osInterface
+    //!           If an OS interface already exists, it may be passed in here for use by the VpHal device, if not, one is created.
+    //! \param    [in] osDriverContext
+    //!           OS context used by to initialize the MOS_INTERFACE, includes information necessary for resource management and interfacing with KMD in general
+    //! \param    [out] eStatus
+    //!           MOS_STATUS, return MOS_STATUS_SUCCESS if successful, otherwise failed.
+    //! \return   VpBase*
+    //!           returns a valid pointer if successful and nullptr if failed.
+    //!
+    static VpBase *CreateFactoryNext(
+        PMOS_INTERFACE osInterface,
+        PMOS_CONTEXT   osDriverContext,
+        MOS_STATUS *   eStatus);
+
+    //!
+    //! \brief    Initializes platform specific state
+    //! \param    [in] osInterface
+    //!           If an OS interface already exists, it may be passed in here for use by the VpHal device, if not, one is created.
+    //! \param    [in] osDriverContext
+    //!           OS context used by to initialize the MOS_INTERFACE, includes information necessary for resource management and interfacing with KMD in general
+    //! \param    [in] bInitVphalState
+    //!           true if initialize m_vphalState, otherwise, initialize m_vpPipeline and m_vpPlatformInterface.
+    //! \param    [out] eStatus
+    //!           MOS status, return MOS_STATUS_SUCCESS if successful, otherwise failed.
+    //! \return   MOS_STATUS_SUCCESS if succeeded, else error code.
+    //!
+    virtual MOS_STATUS Initialize(
+        PMOS_INTERFACE  osInterface,
+        PMOS_CONTEXT    osDriverContext,
+        bool            bInitVphalState,
+        MOS_STATUS      *eStatus) = 0;
+
+    virtual MOS_STATUS CreateVpPlatformInterface(
+        PMOS_INTERFACE osInterface,
+        MOS_STATUS *   eStatus)
+    {
+        return MOS_STATUS_UNIMPLEMENTED;
+    }
+
+    //!
+    //! \brief    Destroys all created VpHal interfaces
+    //! \details  If the HAL creation fails, this is used for cleanup
+    //!
+    void Destroy();
+};
+
+extern template class MediaInterfacesFactory<VphalDevice>;
+
+#endif // __MEDIA_INTERFACES_VPHAL_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/media_interfaces/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/media_interfaces/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/media_interfaces/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/media_interfaces/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2021, Intel Corporation
+# Copyright (c) 2021-2022, Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -20,18 +20,19 @@
 
 
 set(TMP_HEADERS_
+    ${CMAKE_CURRENT_LIST_DIR}/media_interfaces.h
+    ${CMAKE_CURRENT_LIST_DIR}/media_interfaces_vphal.h
     ${CMAKE_CURRENT_LIST_DIR}/media_interfaces_hwinfo.h
+    ${CMAKE_CURRENT_LIST_DIR}/media_interfaces_renderhal.h
+    ${CMAKE_CURRENT_LIST_DIR}/media_interfaces_hwinfo_device.h
 )
 
-
-set(HEADERS_
-    ${HEADERS_}
-    ${TMP_HEADERS_}
-)
-
-set(COMMON_HEADERS_
-    ${COMMON_HEADERS_}
+set(SOFTLET_COMMON_HEADERS_
+    ${SOFTLET_COMMON_HEADERS_}
     ${TMP_HEADERS_}
 )
 
-media_add_curr_to_include_path()
+set(SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_
+    ${SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -21,7 +21,9 @@
 media_include_subdirectory(os)
 media_include_subdirectory(codec)
 media_include_subdirectory(vp)
+media_include_subdirectory(heap_manager)
 media_include_subdirectory(hw)
 media_include_subdirectory(shared)
 media_include_subdirectory(media_interfaces)
+media_include_subdirectory(renderhal)
 
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/os/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/os/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/os/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/os/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -29,11 +29,13 @@ set(TMP_HEADERS_
     ${CMAKE_CURRENT_LIST_DIR}/mos_util_user_interface.h
 )
 
-set(HEADERS_
-    ${HEADERS_}
+set(SOFTLET_MOS_COMMON_HEADERS_
+    ${SOFTLET_MOS_COMMON_HEADERS_}
     ${TMP_HEADERS_}
 )
+set(SOFTLET_MOS_PUBLIC_INCLUDE_DIRS_
+    ${SOFTLET_MOS_PUBLIC_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
 
-source_group( "MOS" FILES ${TMP_HEADERS_} )
-
-media_add_curr_to_include_path()
+source_group( "mos_softlet" FILES ${TMP_HEADERS_} )
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/os/mos_defs.h 22.5.1+ds1-1/media_common/agnostic/common/os/mos_defs.h
--- 22.4.3+ds1-1/media_common/agnostic/common/os/mos_defs.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/os/mos_defs.h	2022-07-19 15:03:31.000000000 +0000
@@ -35,11 +35,12 @@
 #define BASIC_TYPES_DEFINED 1
 #define BOOL_DEF            1  
 
-#include <stdio.h>       // FILE
-#include <stdint.h>
+#include <cstdio>       // FILE
+#include <cstdint>
 #include <string>
 #include <map>
 #include <algorithm>
+#include <memory>
 #include "mos_defs_specific.h"
 
 //!
@@ -497,4 +498,12 @@ typedef uint32_t               GPU_CONTE
 #define MOS_INVALID_HANDLE 0
 #define MOS_DUMMY_FENCE (uint64_t)(-1)
 
+
+namespace MediaUserSetting {
+    class MediaUserSetting;
+};
+
+using MediaUserSettingSharedPtr = std::shared_ptr<MediaUserSetting::MediaUserSetting>;
+
+
 #endif // __MOS_DEFS_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/os/mos_oca_defs.h 22.5.1+ds1-1/media_common/agnostic/common/os/mos_oca_defs.h
--- 22.4.3+ds1-1/media_common/agnostic/common/os/mos_oca_defs.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/os/mos_oca_defs.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     mos_oca_defs.h
+//! \brief    Common structure for OCA
+//!
+
+#ifndef __MOS_OCA_DEFS_H__
+#define __MOS_OCA_DEFS_H__
+
+typedef uint64_t MOS_OCA_BUFFER_HANDLE;
+#define OCA_HEAP_INVALID_OFFSET ((uint32_t)-1)
+
+#define MOS_OCA_INVALID_BUFFER_HANDLE -1
+
+#define MAX_NUM_OF_OCA_BUF_CONTEXT   32
+
+#define OCA_LOG_SECTION_SIZE_MAX        0x3000
+#define OCA_LOG_SECTION_MAGIC_NUMBER    (0x5F691B7E574ACE30)
+
+#define MOS_OCA_MAX_STRING_LEN          (1024)          //!< The max string len for MosOcaStateHeapLog::TraceMessage.
+#define OCA_MAX_RESOURCE_INFO_COUNT_MAX 60
+
+typedef enum _MOS_OCA_LOG_TYPE
+{
+    MOS_OCA_LOG_TYPE_INVALID = 0,
+    MOS_OCA_LOG_TYPE_STRING,
+    MOS_OCA_LOG_TYPE_VP_KERNEL_INFO,
+    MOS_OCA_LOG_TYPE_VPHAL_PARAM,
+    MOS_OCA_LOG_TYPE_CP_PARAM,
+    MOS_OCA_LOG_TYPE_RESOURCE_INFO,
+    MOS_OCA_LOG_TYPE_FENCE_INFO,
+    MOS_OCA_LOG_TYPE_CODECHAL_PARAM,
+    MOS_OCA_LOG_TYPE_COUNT
+}MOS_OCA_LOG_TYPE;
+
+typedef struct _MOS_OCA_LOG_HEADER
+{
+    uint32_t    type;             //!< Oca log type. Refer to MOS_OCA_LOG_TYPE.
+    uint32_t    headerSize;       //!< The size for extented message header.
+    uint32_t    dataSize;         //!< The size of data block without message header.
+}MOS_OCA_LOG_HEADER, *PMOS_OCA_LOG_HEADER;
+
+typedef struct _MOS_OCA_LOG_HEADER_VPHAL_PARAM
+{
+    MOS_OCA_LOG_HEADER header;
+    // Followed by VPHAL_OCA_RENDER_PARAM
+} MOS_OCA_LOG_HEADER_VPHAL_PARAM, *PMOS_OCA_LOG_HEADER_VPHAL_PARAM;
+
+typedef struct _MOS_OCA_LOG_HEADER_CODECHAL_PARAM
+{
+    MOS_OCA_LOG_HEADER header;
+    uint32_t           codec;
+    // Followed by CODECHAL_OCA_DECODE_HEADER
+} MOS_OCA_LOG_HEADER_CODECHAL_PARAM, *PMOS_OCA_LOG_HEADER_CODECHAL_PARAM;
+
+typedef struct _MOS_OCA_LOG_HEADER_RESOURCE_INFO
+{
+    MOS_OCA_LOG_HEADER header;
+    uint32_t           resCount;         // Resource count dumped.
+    uint32_t           resCountSkipped;  // Resource count skiped to be dumped as total count exceeding MOS_OCA_MAX_RESOURCE_INFO_COUNT.
+    // Followed by MOS_OCA_RESOURCE_INFO lists.
+} MOS_OCA_LOG_HEADER_RESOURCE_INFO, *PMOS_OCA_LOG_HEADER_RESOURCE_INFO;
+
+typedef struct _MOS_OCA_LOG_HEADER_VP_KERNEL_INFO
+{
+    MOS_OCA_LOG_HEADER header;
+    int                vpKernelID;
+    int                fcKernelCount;
+    // Followed by fc kernel list.
+} MOS_OCA_LOG_HEADER_VP_KERNEL_INFO, *PMOS_OCA_LOG_HEADER_VP_KERNEL_INFO;
+
+#endif // #ifndef __MOS_OCA_DEFS_H__
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/os/mos_oca_interface.h 22.5.1+ds1-1/media_common/agnostic/common/os/mos_oca_interface.h
--- 22.4.3+ds1-1/media_common/agnostic/common/os/mos_oca_interface.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/os/mos_oca_interface.h	2022-07-19 15:03:31.000000000 +0000
@@ -27,55 +27,7 @@
 #ifndef __MOS_OCA_INTERFACE_H__
 #define __MOS_OCA_INTERFACE_H__
 
-typedef uint64_t MOS_OCA_BUFFER_HANDLE;
-#define OCA_HEAP_INVALID_OFFSET ((uint32_t)-1)
-
-#define MOS_OCA_INVALID_BUFFER_HANDLE -1
-
-#define MAX_NUM_OF_OCA_BUF_CONTEXT   32
-
-#define OCA_LOG_SECTION_SIZE_MAX        0x3000
-#define OCA_LOG_SECTION_MAGIC_NUMBER    (0x5F691B7E574ACE30)
-
-#define MOS_OCA_MAX_STRING_LEN          (1024)          //!< The max string len for MosOcaStateHeapLog::TraceMessage.
-#define OCA_MAX_RESOURCE_INFO_COUNT_MAX 60
-
-
-typedef struct _MOS_OCA_LOG_HEADER
-{
-    uint32_t    type;             //!< Oca log type. Refer to MOS_OCA_LOG_TYPE.
-    uint32_t    headerSize;       //!< The size for extented message header.
-    uint32_t    dataSize;         //!< The size of data block without message header.
-}MOS_OCA_LOG_HEADER, *PMOS_OCA_LOG_HEADER;
-
-typedef struct _MOS_OCA_LOG_HEADER_VPHAL_PARAM
-{
-    MOS_OCA_LOG_HEADER header;
-    // Followed by VPHAL_OCA_RENDER_PARAM
-} MOS_OCA_LOG_HEADER_VPHAL_PARAM, *PMOS_OCA_LOG_HEADER_VPHAL_PARAM;
-
-typedef struct _MOS_OCA_LOG_HEADER_CODECHAL_PARAM
-{
-    MOS_OCA_LOG_HEADER header;
-    uint32_t           codec;
-    // Followed by CODECHAL_OCA_DECODE_HEADER
-} MOS_OCA_LOG_HEADER_CODECHAL_PARAM, *PMOS_OCA_LOG_HEADER_CODECHAL_PARAM;
-
-typedef struct _MOS_OCA_LOG_HEADER_RESOURCE_INFO
-{
-    MOS_OCA_LOG_HEADER header;
-    uint32_t           resCount;         // Resource count dumped.
-    uint32_t           resCountSkipped;  // Resource count skiped to be dumped as total count exceeding MOS_OCA_MAX_RESOURCE_INFO_COUNT.
-    // Followed by MOS_OCA_RESOURCE_INFO lists.
-} MOS_OCA_LOG_HEADER_RESOURCE_INFO, *PMOS_OCA_LOG_HEADER_RESOURCE_INFO;
-
-typedef struct _MOS_OCA_LOG_HEADER_VP_KERNEL_INFO
-{
-    MOS_OCA_LOG_HEADER header;
-    int                vpKernelID;
-    int                fcKernelCount;
-    // Followed by fc kernel list.
-} MOS_OCA_LOG_HEADER_VP_KERNEL_INFO, *PMOS_OCA_LOG_HEADER_VP_KERNEL_INFO;
+#include "mos_oca_defs.h"
 
 class MosOcaInterface
 {
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/os/mos_os.h 22.5.1+ds1-1/media_common/agnostic/common/os/mos_os.h
--- 22.4.3+ds1-1/media_common/agnostic/common/os/mos_os.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/os/mos_os.h	2022-07-19 15:03:31.000000000 +0000
@@ -527,11 +527,14 @@ struct _MOS_GPUCTX_CREATOPTIONS
         uint32_t SSEUValue;
     };
 
+    uint8_t isRealTimePriority;  // 1 if context is created from real time priority command queue (run GT at higher frequency)
+
     _MOS_GPUCTX_CREATOPTIONS() : CmdBufferNumScale(MOS_GPU_CONTEXT_CREATE_DEFAULT),
         RAMode(0),
         ProtectMode(0),
         gpuNode(0),
-        SSEUValue(0){}
+        SSEUValue(0),
+        isRealTimePriority(0){}
 
     virtual ~_MOS_GPUCTX_CREATOPTIONS(){}
 };
@@ -572,7 +575,7 @@ private:
     static std::shared_ptr<GpuCmdResInfoDump> m_instance;
     mutable uint32_t         m_cnt         = 0;
     bool                     m_dumpEnabled = false;
-    std::string              m_path;
+    std::string              m_path        = "";
 };
 #endif // MOS_COMMAND_RESINFO_DUMP_SUPPORTED
 
@@ -1182,15 +1185,6 @@ typedef struct _MOS_INTERFACE
         PMOS_INTERFACE              pOsInterface,
         PMOS_COMMAND_BUFFER         pCmdBuffer);
 
-    MOS_FORMAT (* pfnFmt_OsToMos) (
-        MOS_OS_FORMAT               format);
-
-    MOS_OS_FORMAT (* pfnFmt_MosToOs) (
-        MOS_FORMAT                  format);
-
-    GMM_RESOURCE_FORMAT (* pfnFmt_MosToGmm) (
-        MOS_FORMAT                  format);
-
     void (* pfnSetPerfTag) (
         PMOS_INTERFACE              pOsInterface,
         uint32_t                    PerfTag);
@@ -1324,6 +1318,9 @@ typedef struct _MOS_INTERFACE
     int32_t (*pfnIsGPUHung)(
         PMOS_INTERFACE              pOsInterface);
 
+    bool (*pfnIsMultipleCodecDevicesInUse)(
+        PMOS_INTERFACE              pOsInterface);
+
     //!
     //! \brief    Get Aux Table base address
     //!
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/os/mos_os_trace_event.h 22.5.1+ds1-1/media_common/agnostic/common/os/mos_os_trace_event.h
--- 22.4.3+ds1-1/media_common/agnostic/common/os/mos_os_trace_event.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/os/mos_os_trace_event.h	2022-07-19 15:03:31.000000000 +0000
@@ -88,7 +88,7 @@ typedef enum _MEDIA_EVENT_FILTER_KEYID
     TR_KEY_DECODE_SLICEPARAM,
     TR_KEY_DECODE_TILEPARAM,
     TR_KEY_DECODE_QMATRIX,
-    TR_KEY_DECODE_BITSTREAM_32BYTE,
+    TR_KEY_DECODE_BITSTREAM_INFO,
     TR_KEY_DECODE_BITSTREAM,
     TR_KEY_DECODE_INTERNAL,
     TR_KEY_DECODE_COMMAND,
@@ -101,7 +101,11 @@ typedef enum _MEDIA_EVENT_FILTER_KEYID
     TR_KEY_DATA_DUMP  = 16,
     TR_KEY_MOSMSG_CP,
     TR_KEY_MOSMSG_VP,
-    TR_KEY_MOSMSG_CODEC
+    TR_KEY_MOSMSG_CODEC,
+    TR_KEY_MOSMSG_DDI,
+    TR_KEY_MOSMSG_MOS,
+    TR_KEY_MOSMSG_MHW,
+    TR_KEY_DECODE_INFO
 } MEDIA_EVENT_FILTER_KEYID;
 
 typedef enum _MEDIA_EVENT
@@ -247,8 +251,8 @@ typedef enum _MEDIA_EVENT
     EVENT_DECODE_BUFFER_PICPARAM_VP9,              //! event for Decode VP9 Pic Paramters
     EVENT_DECODE_BUFFER_SEGPARAM_VP9,              //! event for Decode VP9 Segment Paramters
     EVENT_DECODE_BUFFER_SLICEPARAM_VP9,            //! event for Decode VP9 Slice Paramters
-    EVENT_DECODE_BUFFER_Bitstream,                 //! event for Decode Bitstream
-    EVENT_DECODE_CMD_HCP_PIPEMODESELECT,           //! event for Decode HcpPipeModeSelect Cmd
+    EVENT_DECODE_INFO_BITSTREAM,                   //! event for Decode Bitstream Info
+    EVENT_DECODE_INFO_PICTURE,                     //! event for Decode Picture Info
     EVENT_DECODE_CMD_HCP_SURFACESTATE,             //! event for Decode HcpSurfaceState Cmd
     EVENT_DECODE_CMD_HCP_PIPEBUFADDRSTATE,         //! event for Decode HcpPipeBufAddrState Cmd
     EVENT_DECODE_CMD_HCP_INDOBJBASEADDRSTATE,      //! event for Decode HcpIndObjBaseAddrState Cmd
@@ -272,9 +276,17 @@ typedef enum _MEDIA_EVENT
     EVENT_DECODE_FEATURE_VT_SCALABILITY,           //! event for Decode Feature Virtual Tile Scalability
     EVENT_DECODE_FEATURE_RT_SCALABILITY,           //! event for Decode Feature Real Tile Scalability
     EVENT_DECODE_FEATURE_DECODEMODE_REPORT,        //! event for Decode Feature Decode Mode Report
-    EVENT_DECODE_DST_DUMPINFO,                     //! event for Decode Dst Surface Info
-    EVENT_DECODE_REF_DUMPINFO,                     //! event for Decode Ref Surface Info
+    EVENT_DECODE_DUMPINFO_DST,                     //! event for Decode Dst Dump Info
+    EVENT_DECODE_DUMPINFO_REF,                     //! event for Decode Ref Dump Info
     EVENT_CALL_STACK,                              //! event for call stack dump
+    EVENT_ENCODE_DDI_11_CREATEVIDEOENCODER,        //! event for Encode Create Device
+    EVENT_ENCODE_DDI_11_ENCODEFRAME,               //! event for Encode frame, mainly excute
+    EVENT_ENCODE_DDI_11_GETCAPS,                   //! event for Encode getting caps
+    EVENT_ENCODE_DDI_11_GETPROFILECOUNT,           //! event for Encode get profile count
+    EVENT_ENCODE_DDI_11_GETPROFILE,                //! event for Encode get profile
+    EVENT_ENCODE_DDI_11_CHECKFORMAT,               //! event for Encode check format
+    EVENT_ENCODE_DDI_11_GETCONFIGCOUNT,            //! event for Encode get config count
+    EVENT_ENCODE_DDI_11_GETCONFIG,                 //! event for Encode get config
 } MEDIA_EVENT;
 
 typedef enum _MEDIA_EVENT_TYPE
@@ -482,6 +494,7 @@ typedef enum _MT_LOG_ID
     MT_VP_BLT_SEGMENTPARAM,
     MT_VP_BLT_MCPYPARAM,
     MT_VP_USERFEATURE_CTRL,
+    MT_VP_FTR_REPORT,
     MT_VP_HAL_ID_BASE = 0x02000400,
     MT_VP_HAL_PIPELINE_ADAPTER,
     MT_VP_HAL_PIPELINE_ADAPTER_EXT_ENTRY,
@@ -511,6 +524,11 @@ typedef enum _MT_LOG_ID
     MT_VP_HAL_POLICY_INIT_EXECCAPS,
     MT_VP_HAL_FC_SCALINGINFO,
     MT_VP_HAL_VESFC_HWLIMIT,
+    MT_VP_HAL_RENDER_SETUP_WALKER_PARAM,
+    MT_VP_HAL_RENDER_SETUP_CURBE_STATE,
+    MT_VP_HAL_POLICY_FLITER_FTR_COMBINE,
+    MT_VP_HAL_FC_UPDATE_COMP_PARAM,
+    MT_VP_HAL_FC_GET_CURBE_STATE,
     MT_VP_MHW_ID_BASE = 0x02002000,
     MT_VP_MHW_VE_SURFSTATE_INPUT,
     MT_VP_MHW_VE_SURFSTATE_OUT,
@@ -523,6 +541,7 @@ typedef enum _MT_LOG_ID
     MT_VP_KERNEL_CSC,
     MT_VP_KERNEL_RULE,
     MT_VP_KERNEL_LIST_ADD,
+    MT_VP_KERNEL_Init,
     MT_MEDIA_COPY_ID_BASE = 0x02004000,
     MT_VE_DECOMP_COPY,
     MT_MEDIA_COPY,
@@ -710,6 +729,14 @@ typedef enum _MT_PARAM_ID
     MT_VP_HAL_SAMPLER_INDEX,
     MT_VP_HAL_FC_LAYER,
     MT_VP_HAL_FC_LAYER_SURFENTRY,
+    MT_VP_RENDER_VE_FTRINUSE,
+    MT_VP_RENDER_VE_PREPROC_TCC,
+    MT_VP_RENDER_VE_PREPROC_IEF,
+    MT_VP_HAL_EXECCAPS_FORCE_DI2RENDER,
+    MT_VP_HAL_EUFUSION_BYPASS,
+    MT_VP_HAL_MMCINUSE,
+    MT_VP_HAL_FRC_MODE,
+    MT_VP_HAL_CAPTURE_PIPE,
     MT_PARAM_ID_VP_MHW_BASE = 0x02002000,
     MT_VP_MHW_VE_SCALABILITY_EN,
     MT_VP_MHW_VE_SCALABILITY_USE_SFC,
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/os/mos_utilities_common.h 22.5.1+ds1-1/media_common/agnostic/common/os/mos_utilities_common.h
--- 22.4.3+ds1-1/media_common/agnostic/common/os/mos_utilities_common.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/os/mos_utilities_common.h	2022-07-19 15:03:31.000000000 +0000
@@ -104,12 +104,8 @@
 typedef enum _MOS_USER_FEATURE_VALUE_ID
 {
     __MOS_USER_FEATURE_KEY_INVALID_ID = 0,
-    __MEDIA_USER_FEATURE_VALUE_MEDIA_RESET_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_MEDIA_RESET_TH_ID,
     __MEDIA_USER_FEATURE_VALUE_MEDIA_RESET_COUNT_ID,
-    __MEDIA_USER_FEATURE_VALUE_SOFT_RESET_ENABLE_ID,
-    __MEDIA_USER_FEATURE_VALUE_SIM_IN_USE_ID,
-    __MEDIA_USER_FEATURE_VALUE_FORCE_VDBOX_ID,
     __MEDIA_USER_FEATURE_VALUE_LINUX_PERFORMANCETAG_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_PERF_PROFILER_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_PERF_PROFILER_FE_BE_TIMING,
@@ -124,7 +120,6 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __MEDIA_USER_FEATURE_VALUE_PERF_PROFILER_REGISTER_6,
     __MEDIA_USER_FEATURE_VALUE_PERF_PROFILER_REGISTER_7,
     __MEDIA_USER_FEATURE_VALUE_PERF_PROFILER_REGISTER_8,
-    __MEDIA_USER_FEATURE_VALUE_DISABLE_KMD_WATCHDOG_ID,
     __MEDIA_USER_FEATURE_VALUE_SINGLE_TASK_PHASE_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_DECODE_SINGLE_TASK_PHASE_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_AUX_TABLE_16K_GRANULAR_ID,
@@ -133,7 +128,6 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __MEDIA_USER_FEATURE_VALUE_MFE_FIRST_BUFFER_SUBMIT_ID,
     __MEDIA_USER_FEATURE_VALUE_RC_PANIC_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_SLICE_SHUTDOWN_ENABLE_ID,
-    __MEDIA_USER_FEATURE_VALUE_FORCE_YFYS_ID,
     __MEDIA_USER_FEATURE_VALUE_DECODE_LOCK_DISABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_ENCODE_HW_WALKER_ID,
     __MEDIA_USER_FEATURE_VALUE_ENCODE_HUC_FIRMWARE_LOAD_FAILED_ID,
@@ -265,7 +259,6 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __MEDIA_USER_FEATURE_VALUE_MMC_DEC_RT_COMPRESSMODE_ID,
     __MEDIA_USER_FEATURE_VALUE_MMC_ENC_RECON_COMPRESSIBLE_ID,
     __MEDIA_USER_FEATURE_VALUE_MMC_ENC_RECON_COMPRESSMODE_ID,
-    __MEDIA_USER_FEATURE_VALUE_SSEU_SETTING_OVERRIDE_ID,
     __MEDIA_USER_FEATURE_VALUE_SLICE_SHUTDOWN_DEFAULT_STATE_ID,
     __MEDIA_USER_FEATURE_VALUE_SLICE_SHUTDOWN_REQUEST_STATE_ID,
     __MEDIA_USER_FEATURE_VALUE_SLICE_SHUTDOWN_RESOLUTION_THRESHOLD_ID,
@@ -297,13 +290,8 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __MEDIA_USER_FEATURE_VALUE_AV1DFLVROWSTORECACHE_DISABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_AV1CDEFROWSTORECACHE_DISABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_ENABLE_AVP_SCALABILITY_DECODE_ID,
-#if MOS_COMMAND_BUFFER_DUMP_SUPPORTED
-    __MEDIA_USER_FEATURE_VALUE_DUMP_COMMAND_BUFFER_ENABLE_ID,
-#endif  // MOS_COMMAND_BUFFER_DUMP_SUPPORTED
-#if MOS_COMMAND_RESINFO_DUMP_SUPPORTED
-    __MEDIA_USER_FEATURE_VALUE_DUMP_COMMAND_INFO_ENABLE_ID,
-    __MEDIA_USER_FEATURE_VALUE_DUMP_COMMAND_INFO_PATH_ID,
-#endif  // MOS_COMMAND_RESINFO_DUMP_SUPPORTED
+    __MEDIA_USER_FEATURE_VALUE_AV1_DECODE_ON_SIMULATION_ID,
+
 #if (_DEBUG || _RELEASE_INTERNAL)
     __MEDIA_USER_FEATURE_VALUE_ENCODE_HUC_STATUS2_VALUE,
     __MEDIA_USER_FEATURE_VALUE_GROUP_ID_ID,
@@ -323,7 +311,6 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __MEDIA_USER_FEATURE_VALUE_ENCODE_L3_CACHE_SQCREG1_OVERRIDE_ID,
     __MEDIA_USER_FEATURE_VALUE_ENCODE_L3_CACHE_SQCREG4_OVERRIDE_ID,
     __MEDIA_USER_FEATURE_VALUE_ENCODE_L3_LRA_1_REG1_OVERRIDE_ID,
-    __MEDIA_USER_FEATURE_VALUE_NULL_HW_ACCELERATION_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_VDBOX_ID_USED,
     __MEDIA_USER_FEATURE_VALUE_VDENC_IN_USE_ID,
     __MEDIA_USER_FEATURE_VALUE_ENCODE_CSC_METHOD_ID,
@@ -338,7 +325,6 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __MEDIA_USER_FEATURE_VALUE_BSDMPCROWSTORECACHE_DISABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_MPRROWSTORECACHE_DISABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_VDENCROWSTORECACHE_DISABLE_ID,
-    __MEDIA_USER_FEATURE_VALUE_SIM_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_IS_CODEC_ROW_STORE_CACHE_ENABLED_ID,
     __MEDIA_USER_FEATURE_VALUE_BREAK_IN_CODECHAL_CREATE_ID,
     __MEDIA_USER_FEATURE_VALUE_MEDIASOLO_ENABLE_ID,
@@ -411,6 +397,7 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __VPHAL_RT_COMPRESSIBLE_ID,
 #if (_DEBUG || _RELEASE_INTERNAL)
     __VPHAL_ENABLE_1K_1DLUT_ID,
+    __VPHAL_ENABLE_CPU_GENERATE_3DLUT_ID,
 #endif
 #if (_DEBUG || _RELEASE_INTERNAL)
     __VPHAL_ENABLE_COMPUTE_CONTEXT_ID,
@@ -418,8 +405,6 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __MOS_USER_FEATURE_KEY_XML_AUTOGEN_ID,
     __MOS_USER_FEATURE_KEY_XML_FILEPATH_ID,
     __MOS_USER_FEATURE_KEY_XML_DUMP_GROUPS_ID,
-    __MEDIA_USER_FEATURE_VALUE_FORCE_VEBOX_ID,
-    __MEDIA_USER_FEATURE_VALUE_ENABLE_VEBOX_SCALABILITY_MODE_ID,
     __MEDIA_USER_FEATURE_VALUE_VEBOX_SPLIT_RATIO_ID,
     __MEDIA_USER_FEATURE_VALUE_HCP_DECODE_MODE_SWITCH_THRESHOLD1_ID,
     __MEDIA_USER_FEATURE_VALUE_HCP_DECODE_MODE_SWITCH_THRESHOLD2_ID,
@@ -434,13 +419,7 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __MEDIA_USER_FEATURE_VALUE_HEVC_ENCODE_RDOQ_PERF_DISABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_HEVC_TCBRC_QUALITY_BOOST_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_WATCHDOG_TIMER_THRESHOLD,
-    __MEDIA_USER_FEATURE_VALUE_ENABLE_DECODE_VIRTUAL_ENGINE_ID,
-    __MEDIA_USER_FEATURE_VALUE_ENABLE_DECODE_VE_CTXSCHEDULING_ID,
-    __MEDIA_USER_FEATURE_VALUE_ENABLE_LINUX_FRAME_SPLIT_ID,
-    __MEDIA_USER_FEATURE_VALUE_ENABLE_ENCODE_VIRTUAL_ENGINE_ID,
     __MEDIA_USER_FEATURE_VALUE_ENABLE_ENCODE_VE_CTXSCHEDULING_ID,
-    __MEDIA_USER_FEATURE_VALUE_ENABLE_VE_DEBUG_OVERRIDE_ID,
-    __MEDIA_USER_FEATURE_VALUE_ENABLE_HCP_SCALABILITY_DECODE_ID,
     __MEDIA_USER_FEATURE_VALUE_HCP_DECODE_ALWAYS_FRAME_SPLIT_ID,
     __MEDIA_USER_FEATURE_VALUE_SCALABILITY_OVERRIDE_SPLIT_WIDTH_IN_MINCB,
     __MEDIA_USER_FEATURE_VALUE_SCALABILITY_FE_SEPARATE_SUBMISSION_IN_USE_ID,
@@ -453,32 +432,8 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __MEDIA_USER_FEATURE_VALUE_APOGEIOS_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_VPP_APOGEIOS_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_EXTERNAL_COPY_SYNC_ID,
-    __MEDIA_USER_FEATURE_VALUE_ENABLE_UMD_OCA_ID,
-    __MEDIA_USER_FEATURE_VALUE_COUNT_FOR_OCA_BUFFER_LEAKED_ID,
-    __MEDIA_USER_FEATURE_VALUE_COUNT_FOR_OCA_1ST_LEVEL_BB_END_MISSED_ID,
-    __MEDIA_USER_FEATURE_VALUE_COUNT_FOR_ADDITIONAL_OCA_BUFFER_ALLOCATED_ID,
-    __MEDIA_USER_FEATURE_VALUE_OCA_STATUS_ID,
-    __MEDIA_USER_FEATURE_VALUE_OCA_ERROR_HINT_ID,
-    __MEDIA_USER_FEATURE_VALUE_IS_INDIRECT_STATE_HEAP_INVALID_ID,
     __MEDIA_USER_FEATURE_VALUE_INTER_FRAME_MEMORY_NINJA_START_COUNTER_ID,
     __MEDIA_USER_FEATURE_VALUE_INTER_FRAME_MEMORY_NINJA_END_COUNTER_ID,
-#if (_DEBUG || _RELEASE_INTERNAL)
-    __MEDIA_USER_FEATURE_VALUE_ALLOC_MEMORY_FAIL_SIMULATE_MODE_ID,
-    __MEDIA_USER_FEATURE_VALUE_ALLOC_MEMORY_FAIL_SIMULATE_FREQ_ID,
-    __MEDIA_USER_FEATURE_VALUE_ALLOC_MEMORY_FAIL_SIMULATE_HINT_ID,
-    __MEDIA_USER_FEATURE_VALUE_OS_API_FAIL_SIMULATE_TYPE_ID,
-    __MEDIA_USER_FEATURE_VALUE_OS_API_FAIL_SIMULATE_MODE_ID,
-    __MEDIA_USER_FEATURE_VALUE_OS_API_FAIL_SIMULATE_FREQ_ID,
-    __MEDIA_USER_FEATURE_VALUE_OS_API_FAIL_SIMULATE_HINT_ID,
-    __MEDIA_USER_FEATURE_VALUE_MEDIA_TILE_ENCODING_1_DEFAULT_ID,
-    __MEDIA_USER_FEATURE_VALUE_TILE_ENCODING_1_INTERNAL_USED_ID,
-    __MEDIA_USER_FEATURE_VALUE_TILE_ENCODING_3_INTERNAL_USED_ID,
-#endif
-#if (_DEBUG || _RELEASE_INTERNAL)
-        __MEDIA_USER_FEATURE_VALUE_ENABLE_GUC_SUBMISSION_ID,
-#endif
-    __MEDIA_USER_FEATURE_VALUE_PERF_UTILITY_TOOL_ENABLE_ID,
-    __MEDIA_USER_FEATURE_VALUE_PERF_OUTPUT_DIRECTORY_ID,
     __MEDIA_USER_FEATURE_VALUE_APOGEIOS_HEVCD_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_APOGEIOS_AVCD_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_APOGEIOS_VP8D_ENABLE_ID,
@@ -487,10 +442,6 @@ typedef enum _MOS_USER_FEATURE_VALUE_ID
     __MEDIA_USER_FEATURE_VALUE_APOGEIOS_JPEGD_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_RA_MODE_ENABLE_ID,
     __MEDIA_USER_FEATURE_VALUE_LOCAL_MEMORY_LEVEL_SWITCH_ID,
-    __MEDIA_USER_FEATURE_VALUE_NULLHW_ENABLE_ID,
-    __MEDIA_USER_FEATURE_VALUE_MOCKADAPTOR_PLATFORM_ID,
-    __MEDIA_USER_FEATURE_VALUE_MOCKADAPTOR_STEPPING_ID,
-    __MEDIA_USER_FEATURE_VALUE_MOCKADAPTOR_DEVICE_ID,
     __MEDIA_USER_FEATURE_VALUE_DISABLE_TLB_PREFETCH_ID,
 #if (_DEBUG || _RELEASE_INTERNAL)
     __MEDIA_USER_FEATURE_VALUE_FORCE_DECODE_RESOURCE_LOCKABLE_ID,
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/os/mos_util_user_feature_keys.h 22.5.1+ds1-1/media_common/agnostic/common/os/mos_util_user_feature_keys.h
--- 22.4.3+ds1-1/media_common/agnostic/common/os/mos_util_user_feature_keys.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/os/mos_util_user_feature_keys.h	2022-07-19 15:03:31.000000000 +0000
@@ -59,7 +59,13 @@
 #define __MEDIA_USER_FEATURE_VALUE_VDI_MODE                             "VDI Mode"
 #define __MEDIA_USER_FEATURE_VALUE_MEDIA_WALKER_MODE                    "Media Walker Mode"
 
+#define __MEDIA_USER_FEATURE_VALUE_ENABLE_HCP_SCALABILITY_DECODE        "Enable HCP Scalability Decode"
+#define __MEDIA_USER_FEATURE_VALUE_ENABLE_VEBOX_SCALABILITY_MODE        "Enable Vebox Scalability"
+
 #if (_DEBUG || _RELEASE_INTERNAL)
+
+#define __MEDIA_USER_FEATURE_VALUE_MEDIA_RESET_ENABLE                   "Media Reset"
+
 //!
 //! \brief ISA ASM Debug Enable and Debug Surface BTI
 //!
@@ -74,13 +80,38 @@
 //!
 //! \brief enable Huc based DRM for CHV
 //!
-#define __MEDIA_USER_FEATURE_VALUE_HUC_DRM_ENABLE                           "HuC DRM Enable"                 //!< 0: Disable, Others: enable
+#define __MEDIA_USER_FEATURE_VALUE_HUC_DRM_ENABLE                         "HuC DRM Enable"                 //!< 0: Disable, Others: enable
 
 #define __MEDIA_USER_FEATURE_VALUE_MEMORY_NINJA_BEGIN_COUNTER             "MemNinjaBeginCounter"
 #define __MEDIA_USER_FEATURE_VALUE_MEMORY_NINJA_END_COUNTER               "MemNinjaEndCounter"
 
+#define __MEDIA_USER_FEATURE_VALUE_SIM_ENABLE                             "Simulation Enable"
+#define __MEDIA_USER_FEATURE_VALUE_SIM_IN_USE                             "Simulation In Use"
+
+#define __MEDIA_USER_FEATURE_VALUE_ENABLE_VE_DEBUG_OVERRIDE               "Enable VE Debug Override"
+#define __MEDIA_USER_FEATURE_VALUE_FORCE_VDBOX                            "Force VDBOX"
+#define __MEDIA_USER_FEATURE_VALUE_FORCE_VEBOX                            "Force VEBOX"
+#define __MEDIA_USER_FEATURE_VALUE_FORCE_YFYS                             "Force to allocate YfYs"
+
+#define __MEDIA_USER_FEATURE_VALUE_NULL_HW_ACCELERATION_ENABLE            "NullHWAccelerationEnable"
+
+#define __MEDIA_USER_FEATURE_VALUE_ENABLE_LINUX_FRAME_SPLIT               "Enable Linux Frame Split"
+#define __MEDIA_USER_FEATURE_VALUE_ENABLE_GUC_SUBMISSION                  "Enable Guc Submission"
+#define __MEDIA_USER_FEATURE_VALUE_SOFT_RESET_ENABLE                      "Soft Reset"
+
+#define __MEDIA_USER_FEATURE_VALUE_ENABLE_DECODE_VE_CTXSCHEDULING         "Enable Decode VE CtxBasedScheduling"
+#define __MEDIA_USER_FEATURE_VALUE_ENABLE_DECODE_VIRTUAL_ENGINE           "Enable Decode VE"
+#define __MEDIA_USER_FEATURE_VALUE_ENABLE_ENCODE_VIRTUAL_ENGINE           "Enable Encode VE"
 #endif // (_DEBUG || _RELEASE_INTERNAL)
 
+#if MOS_COMMAND_BUFFER_DUMP_SUPPORTED
+#define __MEDIA_USER_FEATURE_VALUE_DUMP_COMMAND_BUFFER_ENABLE             "Dump Command Buffer Enable"
+#endif
+
+#if MOS_COMMAND_RESINFO_DUMP_SUPPORTED
+#define __MEDIA_USER_FEATURE_VALUE_DUMP_COMMAND_INFO_ENABLE               "Dump Command Info Enable"
+#define __MEDIA_USER_FEATURE_VALUE_DUMP_COMMAND_INFO_PATH                 "Dump Command Info Path"
+#endif
 //!
 //! \brief User feature keys to define debug message levels and assertions.
 //!
@@ -312,6 +343,11 @@
 
 #define __VPHAL_ENABLE_VEBOX_MMC_DECOMPRESS                                     "Enable Vebox Decompress"
 
+#define __MEDIA_USER_FEATURE_VALUE_NULLHW_ENABLE                                "NULL HW Enable"
+#define __MEDIA_USER_FEATURE_VALUE_MOCKADAPTOR_PLATFORM                         "MockAdaptor Platform"
+#define __MEDIA_USER_FEATURE_VALUE_MOCKADAPTOR_STEPPING                         "MockAdaptor Stepping"
+#define __MEDIA_USER_FEATURE_VALUE_MOCKADAPTOR_DEVICE                           "MockAdaptor Device ID"
+
 //User feature key for enable Perf Utility Tool
 #define __MEDIA_USER_FEATURE_VALUE_PERF_UTILITY_TOOL_ENABLE          "Perf Utility Tool Enable"
 #define __MEDIA_USER_FEATURE_VALUE_PERF_OUTPUT_DIRECTORY             "Perf Output Directory"
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/renderhal/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/renderhal/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/renderhal/media_srcs.cmake	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/renderhal/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,36 @@
+# Copyright (c) 2022, Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+set(TMP_HEADERS_
+    ${CMAKE_CURRENT_LIST_DIR}/renderhal.h
+    ${CMAKE_CURRENT_LIST_DIR}/renderhal_platform_interface.h
+)
+
+set(SOFTLET_COMMON_HEADERS_
+    ${SOFTLET_COMMON_HEADERS_}
+    ${TMP_HEADERS_}
+)
+
+source_group( "MHW\\Render Hal" FILES ${TMP_HEADERS_} )
+
+set(SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_
+    ${SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/renderhal/renderhal.h 22.5.1+ds1-1/media_common/agnostic/common/renderhal/renderhal.h
--- 22.4.3+ds1-1/media_common/agnostic/common/renderhal/renderhal.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/renderhal/renderhal.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,1916 @@
+/*
+* Copyright (c) 2009-2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file      renderhal.h 
+//! \brief 
+//!
+//!
+//! \file     renderhal.h
+//! \brief    Render Engine Interfaces shared across platforms
+//! \details  Platform Independent Hardware Interfaces
+//!
+#ifndef __RENDERHAL_H__
+#define __RENDERHAL_H__
+
+#include "mos_os.h"                     // Interface to OS functions
+#include "mhw_state_heap.h"
+#include "mhw_render.h"
+#include "mhw_memory_pool.h"
+#include "media_perf_profiler_next.h"
+#include "frame_tracker.h"
+#include "media_common_defs.h"
+
+class XRenderHal_Platform_Interface;
+
+//------------------------------------------------------------------------------
+// Macros specific to RenderHal sub-comp
+//------------------------------------------------------------------------------
+#define MHW_RENDERHAL_ASSERT(_expr)                                                       \
+    MOS_ASSERT(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _expr)
+
+#define MHW_RENDERHAL_ASSERTMESSAGE(_message, ...)                                        \
+    MOS_ASSERTMESSAGE(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _message, ##__VA_ARGS__)
+
+#define MHW_RENDERHAL_NORMALMESSAGE(_message, ...)                                        \
+    MOS_NORMALMESSAGE(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _message, ##__VA_ARGS__)
+
+#define MHW_RENDERHAL_VERBOSEMESSAGE(_message, ...)                                       \
+    MOS_VERBOSEMESSAGE(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _message, ##__VA_ARGS__)
+
+#define MHW_RENDERHAL_FUNCTION_ENTER                                                      \
+    MOS_FUNCTION_ENTER(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL)
+
+#define MHW_RENDERHAL_FUNCTION_EXIT                                                      \
+    MOS_FUNCTION_EXIT(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, eStatus)
+
+#define MHW_RENDERHAL_CHK_STATUS(_stmt)                                                   \
+    MOS_CHK_STATUS(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _stmt)
+
+#define MHW_RENDERHAL_CHK_STATUS_RETURN(_stmt)                                        \
+    MOS_CHK_STATUS_RETURN(MOS_COMPONENT_VP, MOS_VP_SUBCOMP_PUBLIC, _stmt)
+
+#define MHW_RENDERHAL_CHK_STATUS_MESSAGE(_stmt, _message, ...)                        \
+    MOS_CHK_STATUS_MESSAGE(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _stmt, _message, ##__VA_ARGS__)
+
+#define MHW_RENDERHAL_CHK_NULL(_ptr)                                                      \
+    MOS_CHK_NULL(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _ptr)
+
+#define MHW_RENDERHAL_CHK_NULL_NO_STATUS(_ptr)                                            \
+    MOS_CHK_NULL_NO_STATUS(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _ptr)
+
+#define MHW_RENDERHAL_CHK_NULL_NO_STATUS_RETURN(_ptr)                                            \
+    MOS_CHK_NULL_NO_STATUS_RETURN(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _ptr)
+
+#define MHW_RENDERHAL_CHK_NULL_RETURN(_ptr)                                            \
+    MOS_CHK_NULL_RETURN(MOS_COMPONENT_CM, MOS_CM_SUBCOMP_RENDERHAL, _ptr)
+
+
+#define MHW_RENDERHAL_UNUSED(x)                                                         \
+    MOS_UNUSED(x)
+
+//!
+//! \brief  Kernel allocation control
+//!
+#define RENDERHAL_KERNEL_LOAD_FAIL         -1
+#define RENDERHAL_KERNEL_ALLOCATION_FREE    0   // Kernel entry free
+#define RENDERHAL_KERNEL_ALLOCATION_USED    1   // Kernel entry in use
+#define RENDERHAL_KERNEL_ALLOCATION_LOCKED  2   // Kernel entry locked (no garbage collection)
+#define RENDERHAL_KERNEL_ALLOCATION_REMOVED 3   // Kernel entry in use, but no longer loaded in ISH to make room for others
+#define RENDERHAL_KERNEL_ALLOCATION_LOADING 4   // Kernel selected to be loaded (was stale or used)
+#define RENDERHAL_KERNEL_ALLOCATION_STALE   5   // Kernel memory block became invalid, needs to be reloaded
+
+//!
+//! \brief  SSH defaults and limits
+//!
+#define RENDERHAL_SSH_INSTANCES            16
+#define RENDERHAL_SSH_INSTANCES_MAX        64
+
+#define RENDERHAL_SSH_BINDING_TABLES        1
+#define RENDERHAL_SSH_BINDING_TABLES_MIN    1
+#define RENDERHAL_SSH_BINDING_TABLES_MAX   16
+#define RENDERHAL_SSH_BINDING_TABLE_ALIGN  64
+
+#define RENDERHAL_SSH_SURFACE_STATES       40
+#define RENDERHAL_SSH_SURFACE_STATES_MIN   16
+#define RENDERHAL_SSH_SURFACE_STATES_MAX   256
+
+#define RENDERHAL_SSH_SURFACES_PER_BT      64
+#define RENDERHAL_SSH_SURFACES_PER_BT_MIN  4
+#define RENDERHAL_SSH_SURFACES_PER_BT_MAX  256
+
+//!
+//! \brief  Default size of area for sync, debugging, performance collecting
+//!
+#define RENDERHAL_SYNC_SIZE_MIN             128
+#define RENDERHAL_SYNC_SIZE_MAX             4096
+#define RENDERHAL_SYNC_SIZE                 128
+
+//!
+//! \brief  Default number of media states (Dynamic GSH mode)
+//!
+#define RENDERHAL_MEDIA_STATES              16
+
+//!
+//! \brief  Default number of media IDs
+//!
+#define RENDERHAL_MEDIA_IDS                 16
+
+//!
+//! \brief  Max URB Size
+//!
+#define RENDERHAL_URB_SIZE_MAX              2048
+
+//!
+//! \brief  Interface Descriptor Entries
+//!
+#define RENDERHAL_INTERFACE_DESCRIPTOR_ENTRIES_MAX  64
+
+//!
+//! \brief  Max URB Entry Size
+//!
+#define RENDERHAL_URB_ENTRY_SIZE_MAX        (RENDERHAL_URB_SIZE_MAX - RENDERHAL_INTERFACE_DESCRIPTOR_ENTRIES_MAX)
+
+//!
+//! \brief  Max CURBE Allocation Size
+//!
+#define RENDERHAL_CURBE_SIZE_MAX            (RENDERHAL_URB_SIZE_MAX - RENDERHAL_INTERFACE_DESCRIPTOR_ENTRIES_MAX)
+
+//!
+//! \brief  Max Samplers
+//!
+#define RENDERHAL_SAMPLERS_AVS_MAX          8
+
+//!
+//! \brief  Default Samplers
+//!
+#define RENDERHAL_SAMPLERS                  16
+#define RENDERHAL_SAMPLERS_VA               8
+
+//!
+//! \brief  Default CURBE size in GSH
+//!         Use the size of composition kernel static param since it's the largest of all
+//!
+#define RENDERHAL_CURBE_SIZE                832  // MOS ALIGN CEIL(sizeof(GPGPU_WALKER_ISTAB_GMC_STATIC_DATA_G8), RENDERHAL_URB_BLOCK_ALIGN)
+
+//!
+//! \brief  Default number of kernels that may be cached in GSH
+//!
+#define RENDERHAL_KERNEL_COUNT             32
+
+//!
+//! \brief  Max number of kernels cached in GSH
+//!
+#define RENDERHAL_KERNEL_COUNT_MIN          2
+
+//!
+//! \brief  Default kernel heap size
+//!
+#define RENDERHAL_KERNEL_HEAP               2097152
+
+//!
+//! \brief  Min kernel heap size
+//!
+#define RENDERHAL_KERNEL_HEAP_MIN           65536
+#define RENDERHAL_KERNEL_HEAP_MAX           2097152
+
+//!
+//! \brief  Default kernel block size (granularity for kernel allocation)
+//!
+#define RENDERHAL_KERNEL_BLOCK_SIZE         65536
+
+//!
+//! \brief  Default ISA ASM Debug Surface BTI
+//!
+#define RENDERHAL_ISA_ASM_SURFACE_BTI_DEFAULT   39
+
+//!
+//! \brief  Min kernel block size
+//!
+#define RENDERHAL_KERNEL_BLOCK_MIN          1024
+#define RENDERHAL_KERNEL_BLOCK_MAX          65536
+
+//!
+//! \brief  Max number of Media Threads
+//!
+#define RENDERHAL_USE_MEDIA_THREADS_MAX     0
+
+//!
+//! \brief  Number and size of palettes
+//!
+#define RENDERHAL_PALETTE_COUNT             2
+#define RENDERHAL_PALETTE_MAX               2
+
+#define RENDERHAL_PALETTE_ENTRIES           256
+#define RENDERHAL_PALETTE_ENTRIES_MAX       256
+
+//!
+//! \brief  SIP Size
+//!
+#define RENDERHAL_MAX_SIP_SIZE              0x4000
+
+//!
+//! \brief  Number of chroma keys
+//!
+#define RENDERHAL_CHROMA_KEY_COUNT          4
+#define RENDERHAL_CHROMA_KEY_MAX            4
+
+//!
+//! \brief  Alignment
+//!
+#define RENDERHAL_KERNEL_BLOCK_ALIGN        64
+#define RENDERHAL_URB_BLOCK_ALIGN           64
+#define RENDERHAL_SYNC_BLOCK_ALIGN          128
+#define RENDERHAL_CURBE_BLOCK_ALIGN         64
+
+//!
+//! \brief  Max number of Y_Uoffset size
+//!
+#define RENDERHAL_MAX_YV12_PLANE_Y_U_OFFSET_G9          16383
+
+//!
+//! \brief  Palette allocation id
+//!
+#define RENDERHAL_PALETTE_ID_ALLOCATE_ONLY  -2  // Allocate but don't load palette
+#define RENDERHAL_PALETTE_ID_ALLOCATE_LOAD  -1  // Allocate and load palette
+
+//!
+//! \brief  Hw Interface defaults
+//!
+#define RENDERHAL_TIMEOUT_MS_DEFAULT        100
+#define RENDERHAL_EVENT_TIMEOUT_MS          5
+
+//!
+//! \brief  Sampler State Indices
+//!
+#define RENDERHAL_SAMPLER_Y                 1
+#define RENDERHAL_SAMPLER_U                 2
+#define RENDERHAL_SAMPLER_V                 3
+#define RENDERHAL_SAMPLER_8x8_AVS_Y         4
+#define RENDERHAL_SAMPLER_8x8_AVS_U         8
+#define RENDERHAL_SAMPLER_8x8_AVS_V         12
+
+//*-----------------------------------------------------------------------------
+//| MMIO register offsets used for the EU debug support
+//*-----------------------------------------------------------------------------
+
+
+
+#define MEDIASTATE_AVS_MAX_DERIVATIVE_4_PIXELS  7
+#define MEDIASTATE_AVS_MAX_DERIVATIVE_8_PIXELS  20
+#define MEDIASTATE_AVS_TRANSITION_AREA_4_PIXELS 4
+#define MEDIASTATE_AVS_TRANSITION_AREA_8_PIXELS 5
+
+enum GFX_COMMON_TOKEN_SUBOPCODE
+{
+    GFXSUBOP_BINDING_TABLE_STATE_TOKEN  = 0xFE,
+    GFXSUBOP_SURFACE_STATE_TOKEN        = 0xFF
+};
+
+enum MEDIASTATE_AVS_SHARPNESS_LEVEL
+{
+    MEDIASTATE_AVS_SHARPNESS_LEVEL_SMOOTH = 0,
+    MEDIASTATE_AVS_SHARPNESS_LEVEL_SHARP  = 255
+};
+
+// Render chroma siting vertical value
+enum CHROMA_SITING_VDIRECTION
+{
+    CHROMA_SITING_VDIRECTION_0   = 0x0,
+    CHROMA_SITING_VDIRECTION_1_4 = 0x1,
+    CHROMA_SITING_VDIRECTION_1_2 = 0x2,
+    CHROMA_SITING_VDIRECTION_3_4 = 0x3,
+    CHROMA_SITING_VDIRECTION_1   = 0x4
+};
+
+// Render chroma siting horizontal value
+enum CHROMA_SITING_UDIRECTION
+{
+    CHROMA_SITING_UDIRECTION_LEFT   = 0x0,
+    CHROMA_SITING_UDIRECTION_CENTER = 0x1
+};
+
+enum GFX3DSTATE_TILEWALK
+{
+    GFX3DSTATE_TILEWALK_XMAJOR                 = 0,
+    GFX3DSTATE_TILEWALK_YMAJOR                 = 1
+};
+
+enum MEDIA_STATE_DEBUG_COUNTER_CONTROL
+{
+    MEDIASTATE_DEBUG_COUNTER_FREE_RUNNING       = 0,
+    MEDIASTATE_DEBUG_COUNTER_FROZEN             = 1,
+    MEDIASTATE_DEBUG_COUNTER_INITIALIZED_ONCE   = 2,
+    MEDIASTATE_DEBUG_COUNTER_INITIALIZED_ALWAYS = 3
+};
+
+enum MEDIASTATE_BINDING_TABLE_STATE_TYPE
+{
+    MEDIASTATE_BTS_DEFAULT_TYPE             = 0,
+    MEDIASTATE_BTS_DI_SAMPLE8x8_VME_TYPE    = 1
+};
+
+struct SURFACE_STATE_TOKEN_COMMON
+{
+    // DWORD 0
+    union
+    {
+        struct
+        {
+            uint32_t   Length                  : 8;    // OP_LENGTH
+            uint32_t                           : 8;
+            uint32_t   InstructionSubOpcode    : 8;    // GFX3DSTATE_PIPELINED_SUBOPCODE
+            uint32_t   InstructionOpcode       : 3;    // GFX_OPCODE
+            uint32_t   InstructionPipeLine     : 2;    // INSTRUCTION_PIPELINE
+            uint32_t   InstructionType         : 2;    // INSTRUCTION_TYPE
+            uint32_t   Token                   : 1;    // bool
+        };
+
+        // DriverID for IMOLA patching
+        struct
+        {
+            uint32_t   DriverID;
+        };
+
+        struct
+        {
+            uint32_t   Value;
+        };
+    } DW0;
+
+    // DWORD 1
+    union
+    {
+        struct
+        {
+            uint32_t   SurfaceStateHeapOffset  : 16;  // U16 32-byte aligned
+            uint32_t   SurfaceAllocationIndex  : 16;  // U16
+        };
+        struct
+        {
+            uint32_t   Value;
+        };
+    } DW1;
+
+    // DWORD 2
+    union
+    {
+        struct
+        {
+            uint32_t   SurfaceOffset           : 32;
+        };
+        struct
+        {
+            uint32_t   Value;
+        };
+    } DW2;
+
+    // DWORD 3
+    union
+    {
+        struct
+        {
+            uint32_t   RenderTargetEnable      : 1;  // bool
+            uint32_t   YUVPlane                : 2;  // U2
+            uint32_t   SurfaceStateType        : 1;  // U1
+        uint32_t: 28;
+        };
+        struct
+        {
+            uint32_t   Value;
+        };
+    } DW3;
+
+    // DWORD 4
+    union
+    {
+        struct
+        {
+            uint32_t   SurfaceBaseAddress;                                 // SurfaceBaseAddress[31:12]
+        };
+        struct
+        {
+            uint32_t   Value;
+        };
+    } DW4;
+
+    // DWORD 5
+    union
+    {
+        struct
+        {
+            uint32_t   SurfaceBaseAddress64    : BITFIELD_RANGE(0, 15);    // SurfaceBaseAddress[47:32]
+            uint32_t                           : BITFIELD_RANGE(16, 31);
+        };
+        struct
+        {
+            uint32_t   Value;
+        };
+    } DW5;
+
+    void*   pResourceInfo;
+
+};
+
+// Forward declarations
+typedef struct _RENDERHAL_SURFACE    RENDERHAL_SURFACE, *PRENDERHAL_SURFACE;
+typedef struct _RENDERHAL_INTERFACE  RENDERHAL_INTERFACE, *PRENDERHAL_INTERFACE;
+typedef struct _RENDERHAL_SURFACE_STATE_ENTRY *PRENDERHAL_SURFACE_STATE_ENTRY;
+typedef const struct _RENDERHAL_KERNEL_PARAM CRENDERHAL_KERNEL_PARAM, *PCRENDERHAL_KERNEL_PARAM;
+
+//!
+//! Structure RENDERHAL_SETTINGS
+//! \brief RenderHal Settings - creation parameters for RenderHal
+//!
+typedef struct _RENDERHAL_SETTINGS
+{
+    int32_t iMediaStates;
+} RENDERHAL_SETTINGS, *PRENDERHAL_SETTINGS;
+
+//!
+//! Enum RENDERHAL_COMPONENT
+//! \brief RenderHal client component ID (for debugging/timing)
+//!
+typedef enum _RENDERHAL_COMPONENT
+{
+    RENDERHAL_COMPONENT_UNKNOWN = 0,
+    RENDERHAL_COMPONENT_COMP,
+    RENDERHAL_COMPONENT_DNDI,
+    RENDERHAL_COMPONENT_VEBOX,
+    RENDERHAL_COMPONENT_CM,
+    RENDERHAL_COMPONENT_PACKET,
+    RENDERHAL_COMPONENT_16ALIGN,
+    RENDERHAL_COMPONENT_FAST1TON,
+    RENDERHAL_COMPONENT_HDR,
+    RENDERHAL_COMPONENT_COUNT_BASE,
+    RENDERHAL_COMPONENT_RENDER_COPY,
+    RENDERHAL_COMPONENT_RESERVED_NUM = 16,
+    RENDERHAL_COMPONENT_COUNT
+} RENDERHAL_COMPONENT;
+
+//!
+//! \brief Scaling Mode enum
+//!
+typedef enum _RENDERHAL_SCALING_MODE
+{
+    RENDERHAL_SCALING_NEAREST,
+    RENDERHAL_SCALING_BILINEAR,
+    RENDERHAL_SCALING_AVS
+} RENDERHAL_SCALING_MODE;
+
+//!
+//! \brief Surface types enum
+//!        IMPORTANT : SurfaceType_Layer[] must be updated to match this enum type
+//!
+typedef enum _RENDERHAL_SURFACE_TYPE
+{
+    RENDERHAL_SURF_NONE = 0,
+    RENDERHAL_SURF_IN_BACKGROUND,
+    RENDERHAL_SURF_IN_PRIMARY,
+    RENDERHAL_SURF_IN_SUBSTREAM,
+    RENDERHAL_SURF_IN_REFERENCE,
+    RENDERHAL_SURF_OUT_RENDERTARGET,
+    RENDERHAL_SURF_TYPE_COUNT                 //!< Keep this line at the end
+} RENDERHAL_SURFACE_TYPE;
+
+//!
+//! \brief Batch buffer types enum
+//!
+typedef enum _RENDERHAL_BB_TYPE
+{
+    RENDERHAL_BB_TYPE_UNKNOWN        = 0, // Batch Buffer created by unknown client
+    RENDERHAL_BB_TYPE_CM             = 6, // Batch Buffer created by Media Development Framework (CM) component
+    RENDERHAL_BB_TYPE_COUNT
+} RENDERHAL_BB_TYPE;
+
+//!
+//! \brief Sample Type enum
+//!
+typedef enum _RENDERHAL_SAMPLE_TYPE
+{
+    RENDERHAL_SAMPLE_PROGRESSIVE,
+    RENDERHAL_SAMPLE_SINGLE_TOP_FIELD,
+    RENDERHAL_SAMPLE_SINGLE_BOTTOM_FIELD,
+    RENDERHAL_SAMPLE_INTERLEAVED_EVEN_FIRST_TOP_FIELD,
+    RENDERHAL_SAMPLE_INTERLEAVED_EVEN_FIRST_BOTTOM_FIELD,
+    RENDERHAL_SAMPLE_INTERLEAVED_ODD_FIRST_TOP_FIELD,
+    RENDERHAL_SAMPLE_INTERLEAVED_ODD_FIRST_BOTTOM_FIELD,
+    RENDERHAL_SAMPLE_INVALID                            //!< Keep this line at the end
+} RENDERHAL_SAMPLE_TYPE;
+
+//!
+//! Structure RENDERHAL_GET_SURFACE_INFO
+//! \brief Structure to retrieve Surface Infomation Parameters
+//!
+typedef struct _RENDERHAL_GET_SURFACE_INFO
+{
+    uint32_t          ArraySlice;
+    uint32_t          MipSlice;
+    MOS_S3D_CHANNEL   S3dChannel;
+} RENDERHAL_GET_SURFACE_INFO, *PRENDERHAL_GET_SURFACE_INFO;
+
+//!
+//! \brief  Structure of power control info
+//!
+typedef struct _RENDERHAL_POWEROPTION
+{
+    uint16_t nSlice;                      //!< Number of slices to use: 0 (default), 1, 2...
+    uint16_t nSubSlice;                   //!< Number of subslices to use: 0 (default), 1, 2...
+    uint16_t nEU;                         //!< Number of EUs to use: 0 (default), 1, 2...
+} RENDERHAL_POWEROPTION, *PRENDERHAL_POWEROPTION;
+
+//!
+//! Structure RENDERHAL_SURFACE
+//! \brief RENDERHAL surface definition
+//!
+typedef struct _RENDERHAL_SURFACE
+{
+    MOS_SURFACE                 OsSurface;          //!< Surface provided by the client
+
+    // Auxiliary rendering parameters
+    RENDERHAL_SURFACE_TYPE      SurfType;           //!< Surface Type (context)
+    RENDERHAL_SCALING_MODE      ScalingMode;        //!< Scaling Mode
+    MHW_ROTATION                Rotation;           //!< Rotation Mode
+    uint32_t                    ChromaSiting;       //!< Chroma Siting
+
+    // Src/Dst rectangles
+    RECT                        rcSrc;              //!< Source rectangle
+    RECT                        rcDst;              //!< Destination rectangle
+    RECT                        rcMaxSrc;           //!< Max source rectangle
+
+    // Auxiliary VP parameters provided by client
+    bool                        bDeinterlaceEnable; //!< Active Deinterlace messages
+    bool                        bQueryVariance;     //!< enable variance query
+    bool                        bInterlacedScaling; //!< Interlaced scaling
+    void                        *pDeinterlaceParams; //!< Pointer to Deinterlacing parameters
+    RENDERHAL_SAMPLE_TYPE       SampleType;         //!< Interlaced/Progressive sample type
+    int32_t                     iPaletteID;         //!<Palette ID
+
+    uint32_t                    dwWidthInUse;       //!< the actual width in use
+    uint32_t                    dwHeightInUse;      //!< the actual height in use
+} RENDERHAL_SURFACE , *PRENDERHAL_SURFACE;
+
+//!
+//! Structure RENDERHAL_OFFSET_OVERRIDE
+//! \brief structure used to alloce Surface State overrides for Kernel
+//!
+typedef struct _RENDERHAL_OFFSET_OVERRIDE
+{
+    // Y plane adjustment
+    int32_t iYOffsetAdjust;             //!< Surface Offset adjustment for Y plane
+    int32_t iYOffsetX;                  //!< X-Offset override for Y plane
+    int32_t iYOffsetY;                  //!< Y-Offset override for Y plane
+
+    // UV plane overrides/adjustmenty
+    int32_t iUVOffsetAdjust;            //!< Surface Offset adjustment for UV plane
+    int32_t iUVOffsetX;                 //!< X-Offset override for UV plane
+    int32_t iUVOffsetY;                 //!< Y-Offset override for UV plane
+} RENDERHAL_OFFSET_OVERRIDE, *PRENDERHAL_OFFSET_OVERRIDE;
+
+typedef enum _RENDERHAL_SURFACE_STATE_TYPE
+{
+    RENDERHAL_SURFACE_TYPE_INVALID  = 0,
+    RENDERHAL_SURFACE_TYPE_G8       ,
+    RENDERHAL_SURFACE_TYPE_G9       ,
+    RENDERHAL_SURFACE_TYPE_G10      ,
+    RENDERHAL_SURFACE_TYPE_ADV_G8   ,
+    RENDERHAL_SURFACE_TYPE_ADV_G9   ,
+    RENDERHAL_SURFACE_TYPE_ADV_G10
+} RENDERHAL_SURFACE_STATE_TYPE, *PRENDERHAL_SURFACE_STATE_TYPE;
+
+typedef enum _RENDERHAL_PLANE_DEFINITION
+{
+    RENDERHAL_PLANES_PL3            = 0,
+    RENDERHAL_PLANES_NV12              ,
+    RENDERHAL_PLANES_YUY2              ,
+    RENDERHAL_PLANES_UYVY              ,
+    RENDERHAL_PLANES_YVYU              ,
+    RENDERHAL_PLANES_VYUY              ,
+    RENDERHAL_PLANES_ARGB              ,
+    RENDERHAL_PLANES_XRGB              ,
+    RENDERHAL_PLANES_ABGR              ,
+    RENDERHAL_PLANES_XBGR              ,
+    RENDERHAL_PLANES_RGB16             ,
+    RENDERHAL_PLANES_RGB24             ,
+    RENDERHAL_PLANES_R16U              ,
+    RENDERHAL_PLANES_R16S              ,
+    RENDERHAL_PLANES_R32U              ,
+    RENDERHAL_PLANES_R32S              ,
+    RENDERHAL_PLANES_R32F              ,
+    RENDERHAL_PLANES_V8U8              ,
+    RENDERHAL_PLANES_R8G8_UNORM        ,
+    RENDERHAL_PLANES_411P              ,
+    RENDERHAL_PLANES_411R              ,
+    RENDERHAL_PLANES_422H              ,
+    RENDERHAL_PLANES_422V              ,
+    RENDERHAL_PLANES_444P              ,
+    RENDERHAL_PLANES_RGBP              ,
+    RENDERHAL_PLANES_BGRP              ,
+
+    RENDERHAL_PLANES_AI44_PALLETE_0    ,
+    RENDERHAL_PLANES_IA44_PALLETE_0    ,
+    RENDERHAL_PLANES_P8_PALLETE_0      ,
+    RENDERHAL_PLANES_A8P8_PALLETE_0    ,
+    RENDERHAL_PLANES_AI44_PALLETE_1    ,
+    RENDERHAL_PLANES_IA44_PALLETE_1    ,
+    RENDERHAL_PLANES_P8_PALLETE_1      ,
+    RENDERHAL_PLANES_A8P8_PALLETE_1    ,
+
+    RENDERHAL_PLANES_AYUV              ,
+    RENDERHAL_PLANES_STMM              ,
+    RENDERHAL_PLANES_L8                ,
+
+    RENDERHAL_PLANES_PL3_ADV           ,
+    RENDERHAL_PLANES_NV12_ADV          ,
+    RENDERHAL_PLANES_YUY2_ADV          ,
+    RENDERHAL_PLANES_UYVY_ADV          ,
+    RENDERHAL_PLANES_YVYU_ADV          ,
+    RENDERHAL_PLANES_VYUY_ADV          ,
+    RENDERHAL_PLANES_ARGB_ADV          ,
+    RENDERHAL_PLANES_ABGR_ADV          ,
+    RENDERHAL_PLANES_AYUV_ADV           ,
+    RENDERHAL_PLANES_STMM_ADV          ,
+    RENDERHAL_PLANES_L8_ADV            ,
+    RENDERHAL_PLANES_A8_ADV            ,
+    RENDERHAL_PLANES_A8                ,
+    RENDERHAL_PLANES_R8                ,
+    RENDERHAL_PLANES_NV12_2PLANES      ,
+    RENDERHAL_PLANES_NV12_2PLANES_ADV  ,
+    RENDERHAL_PLANES_411P_ADV          ,
+    RENDERHAL_PLANES_411R_ADV          ,
+    RENDERHAL_PLANES_422H_ADV          ,
+    RENDERHAL_PLANES_422V_ADV          ,
+    RENDERHAL_PLANES_444P_ADV          ,
+    RENDERHAL_PLANES_RGBP_ADV          ,
+    RENDERHAL_PLANES_BGRP_ADV          ,
+    RENDERHAL_PLANES_R16_UNORM         ,
+    RENDERHAL_PLANES_Y8                ,
+    RENDERHAL_PLANES_Y1                ,
+    RENDERHAL_PLANES_Y16U              ,
+    RENDERHAL_PLANES_Y16S              ,
+    RENDERHAL_PLANES_A16B16G16R16      ,
+    RENDERHAL_PLANES_A16B16G16R16_ADV  ,
+    RENDERHAL_PLANES_R10G10B10A2       ,
+    RENDERHAL_PLANES_R10G10B10A2_ADV   ,
+    RENDERHAL_PLANES_B10G10R10A2       ,
+    RENDERHAL_PLANES_L16               ,
+    RENDERHAL_PLANES_NV21              ,
+    RENDERHAL_PLANES_YV12              ,
+    RENDERHAL_PLANES_P016              ,
+    RENDERHAL_PLANES_P016_2PLANES_ADV  ,
+    RENDERHAL_PLANES_P010              ,
+    RENDERHAL_PLANES_P010_1PLANE       ,
+    RENDERHAL_PLANES_P010_1PLANE_ADV   ,
+    RENDERHAL_PLANES_IRW0              ,
+    RENDERHAL_PLANES_IRW1              ,
+    RENDERHAL_PLANES_IRW2              ,
+    RENDERHAL_PLANES_IRW3              ,
+    RENDERHAL_PLANES_A16B16G16R16F     ,
+    RENDERHAL_PLANES_R16G16_UNORM      ,
+    RENDERHAL_PLANES_R16_FLOAT         ,
+    RENDERHAL_PLANES_A16R16G16B16F     ,
+    RENDERHAL_PLANES_YUY2_2PLANES      ,
+    RENDERHAL_PLANES_Y210_ADV          ,
+    RENDERHAL_PLANES_Y210_RT           ,
+    RENDERHAL_PLANES_Y210              ,
+    RENDERHAL_PLANES_Y210_1PLANE_ADV   ,
+    RENDERHAL_PLANES_R16G16_SINT       ,
+    RENDERHAL_PLANES_R24_UNORM_X8_TYPELESS,
+    RENDERHAL_PLANES_R32_FLOAT_X8X24_TYPELESS,
+    RENDERHAL_PLANES_P208,
+    RENDERHAL_PLANES_P208_1PLANE_ADV,
+    RENDERHAL_PLANES_Y416_RT,
+    RENDERHAL_PLANES_R32G32B32A32F,
+    RENDERHAL_PLANES_Y8_ADV,
+
+    RENDERHAL_PLANES_DEFINITION_COUNT
+} RENDERHAL_PLANE_DEFINITION, *PRENDERHAL_PLANE_DEFINITION;
+
+typedef enum _RENDERHAL_SS_BOUNDARY
+{
+    RENDERHAL_SS_BOUNDARY_SRCRECT = 0,                                                    // use for sources read via sampler
+    RENDERHAL_SS_BOUNDARY_DSTRECT ,                                                       // use for RT by default
+    RENDERHAL_SS_BOUNDARY_MAXSRCRECT,                                                     // use max source rect
+    RENDERHAL_SS_BOUNDARY_ORIGINAL,                                                       // use for surfs that are not source or RT
+} RENDERHAL_SS_BOUNDARY;
+
+//!
+//! \brief  Surface cache attributes
+//!
+#define RENDERHAL_MEMORY_OBJECT_CONTROL     uint32_t
+
+typedef struct _RENDERHAL_KERNEL_PARAM
+{
+    int32_t             GRF_Count;                                              // Number of registers
+    int32_t             BT_Count;                                               // Number of BT entries
+    int32_t             Sampler_Count;                                          // Number of samplers
+    int32_t             Thread_Count;                                           // Number of threads (max)
+    int32_t             GRF_Start_Register;                                     // Start register
+    int32_t             CURBE_Length;                                           // Constant URB length (in 256-bits)
+    int32_t             block_width;                                            // Block width
+    int32_t             block_height;                                           // Block height
+    int32_t             blocks_x;                                               // Blocks in x
+    int32_t             blocks_y;                                               // Blocks in y
+} RENDERHAL_KERNEL_PARAM, *PRENDERHAL_KERNEL_PARAM;
+
+typedef struct _RENDERHAL_CLONE_KERNEL_PARAM
+{
+    bool                isClone;                                                // If kernel has been cloned from another kernel (i.e. share same kernel binary)
+    bool                isHeadKernel;                                           // If kernel is the "head" kernel (i.e. this allocation contains the kernel binary)
+    int32_t             referenceCount;                                         // Number of cloned kernels currently pointing to the head kernel
+    int32_t             cloneKernelID;                                          // Kernel ID of source kernel (i.e. kernel used to clone)
+    int32_t             kernelBinaryAllocID;                                    // Allocation ID of the head kernel that contains the actual kernel binary
+    uint32_t            dwOffsetForAllocID;                                     // Save the offset for this allocation ID, if clone using a different offset to point to head kernel binary
+}RENDERHAL_CLONE_KERNEL_PARAM, *PRENDERHAL_CLONE_KERNEL_PARAM;
+
+typedef struct tagKdll_CacheEntry Kdll_CacheEntry;
+typedef struct _RENDERHAL_KRN_ALLOCATION *PRENDERHAL_KRN_ALLOCATION;
+typedef struct _RENDERHAL_KRN_ALLOC_LIST *PRENDERHAL_KRN_ALLOC_LIST;
+
+typedef struct _RENDERHAL_KRN_ALLOCATION
+{
+    int32_t                      iKID;                                          // Interface descriptor ID for the kernel (for 2nd level buffer)
+    int32_t                      iKUID;                                         // Kernel Unique ID
+    int32_t                      iKCID;                                         // Kernel Cache ID
+    uint32_t                     dwSync;                                        // Kernel last sync (used to determine whether the kernel may be unloaded)
+    FrameTrackerTokenFlat        trackerToken;                                  // Kernel last sync with multiple trackers
+    uint32_t                     dwOffset;                                      // Kernel offset in GSH (from GSH base, 0 is KAC entry is available)
+    int32_t                      iSize;                                         // Kernel block size in GSH (0 if not loaded)
+    uint32_t                     dwFlags : 4;                                   // Kernel allocation flag
+    uint32_t                     dwCount : 28;                                  // Kernel refresh counter
+    RENDERHAL_KERNEL_PARAM       Params;                                        // Kernel parameters for RenderHal (states, rendering, etc)
+    PMHW_KERNEL_PARAM            pMhwKernelParam;                               // Pointer to Kernel parameters for MHW
+    Kdll_CacheEntry             *pKernelEntry;                                  // Pointer to Kernel entry for VP/KDLL
+    RENDERHAL_CLONE_KERNEL_PARAM cloneKernelParams;                             // CM - Clone kernel information
+    int32_t                 iAllocIndex;                                        // Kernel allocation index (index in kernel allocation table)
+
+    // DSH - Dynamic list of kernel allocations
+    PMHW_STATE_HEAP_MEMORY_BLOCK pMemoryBlock;                                  // Memory block in ISH
+    PRENDERHAL_KRN_ALLOCATION    pNext;                                         // Next kernel in list
+    PRENDERHAL_KRN_ALLOCATION    pPrev;                                         // Prev kernel in list
+    PRENDERHAL_KRN_ALLOC_LIST    pList;                                         // Points to current list, regardless of flag
+    uint32_t                     Reserved    : 16;                              // Reserved    - used for debugging
+    uint32_t                                 : 16;                              //
+    char                         *szKernelName;                                  // Kernel name - used for debugging
+} RENDERHAL_KRN_ALLOCATION, *PRENDERHAL_KRN_ALLOCATION;
+
+typedef struct _RENDERHAL_KRN_ALLOC_LIST
+{
+    PRENDERHAL_KRN_ALLOCATION pHead;                                            // Head of the list
+    PRENDERHAL_KRN_ALLOCATION pTail;                                            // Tail of the list
+    int32_t                   iCount;                                           // Number of objects
+} RENDERHAL_KRN_ALLOC_LIST, *PRENDERHAL_KRN_ALLOC_LIST;
+
+typedef struct _RENDERHAL_MEDIA_STATE *PRENDERHAL_MEDIA_STATE;
+
+typedef struct _RENDERHAL_MEDIA_STATE
+{
+    // set at creation time
+    uint32_t            dwOffset;                                               // Media State Base Address (from GSH base) - VFE
+    int32_t             *piAllocation;                                           // Kernel allocation table
+
+    // set at runtime
+    uint32_t            dwSyncTag;                                              // Sync Tag
+    FrameTrackerTokenFlat trackerToken;
+    uint32_t            dwSyncCount;                                            // Number of sync tags
+    int32_t             iCurbeOffset;                                           // Current CURBE Offset
+    uint32_t            bBusy   : 1;                                            // 1 if the state is in use (must sync before use)
+    uint32_t                    : 15;
+    uint32_t            Reserved: 16;
+
+    PRENDERHAL_MEDIA_STATE      pPrev;                                          // Next Media State
+    PRENDERHAL_MEDIA_STATE      pNext;                                          // Previous Media State
+} RENDERHAL_MEDIA_STATE, *PRENDERHAL_MEDIA_STATE;
+
+typedef struct _RENDERHAL_MEDIA_STATE_LIST
+{
+    PRENDERHAL_MEDIA_STATE  pHead;                                              // Head of the list
+    PRENDERHAL_MEDIA_STATE  pTail;                                              // Tail of the list
+    int32_t                 iCount;                                             // Number of objects
+} RENDERHAL_MEDIA_STATE_LIST, *PRENDERHAL_MEDIA_STATE_LIST;
+
+struct RENDERHAL_TR_RESOURCE {
+    MOS_RESOURCE    osResource;
+    bool            locked;
+    uint32_t        *data;
+    uint32_t        currentTrackerId;
+};
+
+typedef struct _RENDERHAL_STATE_HEAP_SETTINGS
+{
+    // Global GSH Allocation parameters
+    int32_t             iSyncSize;                                              // Sync area for sync, perf, debug
+
+    // Media State Allocation parameters
+    int32_t             iMediaStateHeaps;                                       // Number of Media State heaps
+    int32_t             iMediaIDs;                                              // Number of Media Interface Descriptors
+    int32_t             iCurbeSize;                                             // Size of CURBE area
+    int32_t             iSamplers;                                              // Number of Samplers/ID
+    int32_t             iSamplersAVS;                                           // Number of AVS Samplers/ID
+    int32_t             iSamplersVA;                                            // Number of Video Analytics Samplers/ID
+    int32_t             iKernelCount;                                           // Number of Kernels that can be loaded
+    int32_t             iKernelHeapSize;                                        // Size of GSH block for kernels
+    int32_t             iKernelBlockSize;                                       // Kernel allocation block
+
+    // Media VFE/ID configuration, limits
+    int32_t             iPerThreadScratchSize;                                  // Size of the Scratch memory per Thread
+    int32_t             iSipSize;                                               // SIP size
+
+    // Surface State Heap Settings
+    int32_t             iSurfaceStateHeaps;                                     // Number of SSH instances (same as iMediaStateHeaps)
+    int32_t             iBindingTables;                                         // Number of BT per SSH instance
+    int32_t             iSurfaceStates;                                         // Number of Surfaces per SSH
+    int32_t             iSurfacesPerBT;                                         // Number of Surfaces per BT
+    int32_t             iBTAlignment;                                           // BT Alignment size
+} RENDERHAL_STATE_HEAP_SETTINGS, *PRENDERHAL_STATE_HEAP_SETTINGS;
+
+typedef struct _RENDERHAL_STATE_HEAP
+{
+    //---------------------------
+    // General State Heap
+    //---------------------------
+    uint32_t                dwSizeGSH;                                          // GSH size
+    MOS_RESOURCE            GshOsResource;                                      // GSH OS Buffer
+    bool                    bGshLocked;                                         // GSH is locked
+    uint8_t                 *pGshBuffer;                                         // Pointer to GSH buffer data
+
+    // Dynamic GSH sync
+    uint32_t                dwOffsetSync;                                       // Offset of sync/perf data in GSH
+    uint32_t                dwSizeSync;                                         // Size of sync data
+
+    // Synchronization / Performance / Statistics
+    volatile uint32_t       *pSync;                                              // Pointer to sync area (when locked)
+    uint32_t                dwNextTag;                                          // Next sync tag value to use
+    uint32_t                dwSyncTag;                                          // Last sync tag completed
+    uint32_t                dwFrameId;                                          // Last frame id completed
+
+    // Media states
+    int32_t                 iCurMediaState;                                     // Current Media State Index
+    int32_t                 iNextMediaState;                                    // Next Media State Index
+    PRENDERHAL_MEDIA_STATE  pCurMediaState;                                     // Current Media state in use
+    uint32_t                dwSizeMediaState;                                   // Size of Media state
+
+    uint32_t                dwOffsetMediaID;                                    // Offset to Media IDs from Media State Base
+    uint32_t                dwSizeMediaID;                                      // Size of each Media ID
+
+    MHW_ID_ENTRY_PARAMS     CurIDEntryParams = {};                              // Parameters for current Interface Descriptor Entry
+
+    // Performance capture
+    uint32_t                dwOffsetStartTime;                                  // Offset to the start time of the media state
+    uint32_t                dwStartTimeSize;                                    // Size of Start time
+    uint32_t                dwOffsetEndTime;                                    // Offset to the end time of the media state
+    uint32_t                dwEndTimeSize;                                      // Size of end time
+    uint32_t                dwOffsetComponentID;                                // Render Component
+    uint32_t                dwComponentIDSize;                                  // Render ComponentID size
+    uint32_t                dwOffsetReserved;                                   // Reserved (Curbe should be 64 aligned)
+    uint32_t                dwReservedSize;                                     // 64 - (start time + end time + component)
+
+    uint32_t                dwOffsetCurbe;                                      // Offset to Media CURBE data from Media State Base
+    uint32_t                dwSizeCurbe;                                        // Size of CURBE area
+
+    uint32_t                dwOffsetSampler;                                    // Offset to Media Samplers from Media State Base
+    uint32_t                dwSizeSampler;                                      // Size of Samplers
+
+    uint32_t                dwOffsetSamplerIndirect;                            // Offset to Media Samplers Indirect State from Media State Base
+    uint32_t                dwSizeSamplerIndirect;                              // Size of Samplers Indirect State
+
+    uint32_t                dwOffsetSampler8x8Table;                            // Offset to Media Sampler State Table for AVS from Media State Base
+    uint32_t                dwSizeSampler8x8Table;                              // Size of Sampler State Table for AVS
+
+    uint32_t                dwOffsetSamplerVA;                                  // Offset to Video Analytics Samplers from Media State Base
+    uint32_t                dwSizeSamplerVA;                                    // Size of VA Samplers
+
+    uint32_t                dwOffsetSamplerAVS;                                 // Offset to 8x8 Samplers from Media State Base
+    uint32_t                dwSizeSamplerAVS;                                   // Size of 8x8 Samplers
+
+    uint32_t                dwSizeSamplers;                                     // Size of All Samplers
+
+    PRENDERHAL_MEDIA_STATE  pMediaStates;                                       // Media state table
+
+    // Dynamic Media states
+    PMHW_MEMORY_POOL            pMediaStatesMemPool;                            // Media state memory allocations
+    RENDERHAL_MEDIA_STATE_LIST  FreeStates;                                     // Free media state objects (pool)
+    RENDERHAL_MEDIA_STATE_LIST  ReservedStates;                                 // Reserved media states
+    RENDERHAL_MEDIA_STATE_LIST  SubmittedStates;                                // Submitted media states
+
+    //---------------------------
+    // Surface State Heap
+    //---------------------------
+    uint32_t                dwSizeSSH;                                          // SSH size
+    MOS_RESOURCE            SshOsResource;                                      // SSH OS Buffer
+    bool                    bSshLocked;                                         // SSH is locked
+    uint8_t                 *pSshBuffer;                                         // Pointer to SSH buffer base
+    uint32_t                dwSshIntanceSize;                                   // SSH instance size
+
+    // BT size, offsets to BT/SS entries in SSH
+    int32_t                 iBindingTableSize;                                  // Size of each BT (in bytes)
+    int32_t                 iBindingTableOffset;                                // First BT offset in SSH buffer
+    int32_t                 iSurfaceStateOffset;                                // First SS offset in SSH buffer
+
+    // Array of Surface State control structures
+    PRENDERHAL_SURFACE_STATE_ENTRY  pSurfaceEntry;
+
+    // Current allocations
+    int32_t                 iCurSshBufferIndex;                                 // Current SSH Buffer instance in the SSH heap
+    int32_t                 iCurrentBindingTable;                               // Current BT
+    int32_t                 iCurrentSurfaceState;                               // Current SS
+
+    //---------------------------
+    // Instruction State Heap
+    //---------------------------
+    uint32_t                dwSizeISH;                                          // ISH size
+    MOS_RESOURCE            IshOsResource;                                      // ISH OS Buffer
+    bool                    bIshLocked;                                         // ISH is locked
+    uint8_t                 *pIshBuffer;                                         // Pointer to ISH buffer data
+    uint32_t                dwKernelBase;                                       // Offset of kernels in ISH
+
+    // Kernel Allocation
+    int32_t                 iKernelSize;                                        // Kernel heap size
+    int32_t                 iKernelUsed;                                        // Kernel heap used size
+    uint8_t                 *pKernelLoadMap;                                     // Kernel load map
+    uint32_t                dwAccessCounter;                                    // Incremented when a kernel is loaded/used, for dynamic allocation
+    int32_t                 iKernelUsedForDump;                                 // The kernel size to be dumped in oca buffer.
+
+    // Kernel Spill Area
+    uint32_t                dwScratchSpaceSize;                                 // Size of the Scratch Area
+    uint32_t                dwScratchSpaceBase;                                 // Base of the Scratch area
+
+    // System Routine
+    uint32_t                dwSipBase;                                          // Base of the System Routine
+
+    // Arrays created dynamically
+    PRENDERHAL_KRN_ALLOCATION   pKernelAllocation;                              // Kernel allocation table (or linked list)
+
+    // Dynamic Kernel States
+    PMHW_MEMORY_POOL               pKernelAllocMemPool;                         // Kernel states memory pool (mallocs)
+    RENDERHAL_KRN_ALLOC_LIST       KernelAllocationPool;                        // Pool of kernel allocation objects
+    RENDERHAL_KRN_ALLOC_LIST       KernelsSubmitted;                            // Kernel submission list
+    RENDERHAL_KRN_ALLOC_LIST       KernelsAllocated;                            // kernel allocation list (kernels in ISH not currently being executed)
+
+} RENDERHAL_STATE_HEAP, *PRENDERHAL_STATE_HEAP;
+
+typedef struct _RENDERHAL_DYNAMIC_MEDIA_STATE_PARAMS
+{
+    int32_t             iMaxMediaIDs;               // Maximum number of media interface descriptors
+    int32_t             iMaxThreads;                // Maximum number of threads to be executed (0 = limited to HW threads) - for scratch space allocation
+    int32_t             iMaxSpillSize;              // Maximum spill sizes among all kernels to be executed - used for scratch space allocation
+    int32_t             iMaxCurbeOffset;            // Maximum offset reserved for CURBE
+    int32_t             iMaxCurbeSize;              // Maximum size reserved for CURBE
+    int32_t             iMaxSamplerIndex3D;         // Maximum 3D sampler index
+    int32_t             iMaxSamplerIndexAVS;        // Maximum AVS sampler index
+    int32_t             iMaxSamplerIndexConv;       // Maximum Conv sampler index
+    int32_t             iMaxSamplerIndexMisc;       // Maximum Misc (VA) sampler index
+    int32_t             iMax8x8Tables;              // Maximum Number of 8x8 tables per MediaID
+} RENDERHAL_DYNAMIC_MEDIA_STATE_PARAMS, *PRENDERHAL_DYNAMIC_MEDIA_STATE_PARAMS;
+
+typedef struct _RENDERHAL_INTERFACE_DESCRIPTOR_PARAMS
+{
+    int32_t             iMediaID;
+    int32_t             iBindingTableID;
+    int32_t             iCurbeOffset;
+    int32_t             iCurbeLength;
+    int32_t             iCrsThrdConstDataLn;
+    int32_t             iNumberThreadsInGroup;
+    bool                blGlobalBarrierEnable;
+    bool                blBarrierEnable;
+    int32_t             iSLMSize;
+} RENDERHAL_INTERFACE_DESCRIPTOR_PARAMS, *PRENDERHAL_INTERFACE_DESCRIPTOR_PARAMS;
+
+//!
+//! \brief  ======== HW Abstraction Params ===================================
+//!
+
+typedef struct _RENDERHAL_SURFACE_STATE_PARAMS
+{
+    RENDERHAL_SURFACE_STATE_TYPE    Type                      : 5;              // Type of surface state
+    uint32_t                        bRenderTarget             : 1;              // Render target flag
+    uint32_t                        bVertStride               : 1;              // VL Stride
+    uint32_t                        bVertStrideOffs           : 1;              // VL Stride Offset
+    uint32_t                        bWidthInDword_Y           : 1;              // Width in dwords
+    uint32_t                        bWidthInDword_UV          : 1;
+    uint32_t                        bAVS                      : 1;              // AVS scaling
+    RENDERHAL_SS_BOUNDARY           Boundary                  : 3;              // boundary to be aligned to rcSrc/rcDst/actual wd/ht
+    uint32_t                        bWidth16Align             : 1;              // When VDI Walker is enabled, input surface width must be 16 aligned
+    uint32_t                        b2PlaneNV12NeededByKernel : 1;              // Kernel needs surface state for both Y and UV
+    uint32_t                        bForceNV12                : 1;              // Forces format to be treated as NV12. Only used in FRC.
+    uint32_t                        bUseSinglePlane           : 1;              // 1 indicates using one plane only
+    uint32_t                        b32MWColorFillKern        : 1;              // Flag for 32x32 Media walker + ColorFill kernel case
+    uint32_t                        bVASurface                : 1;              // Value is 1 if VA surface, 0 if AVS surface
+    uint32_t                        AddressControl            : 2;              // 0 clamp, 1 mirror, 2, 3 reserved
+    uint32_t                        bWAUseSrcHeight           : 1;              // Surface state height use src height or surface height
+    uint32_t                        bWAUseSrcWidth            : 1;              // Surface state width use src width or surface width
+    uint32_t                        bForce3DLUTR16G16         : 1;              // Flag for 3D LUT source and targetsurface
+    uint32_t                        bChromasiting             : 1;              // Flag for chromasiting use
+    uint32_t                        bVmeUse                   : 1;              // Flag for VME use
+    uint32_t                        bBufferUse                : 1;              // Flags for 1D buffer use
+    uint32_t                                                  : 3;
+    RENDERHAL_MEMORY_OBJECT_CONTROL MemObjCtl;                                  // Caching attributes
+} RENDERHAL_SURFACE_STATE_PARAMS, *PRENDERHAL_SURFACE_STATE_PARAMS;
+
+typedef struct _RENDERHAL_SURFACE_STATE_ENTRY
+{
+    RENDERHAL_SURFACE_STATE_TYPE    Type;                                           // Type of surface state
+    PMOS_SURFACE                    pSurface;                                       // Pointer to OS surface
+    uint8_t                         *pSurfaceState;                                 // Pointer to Surface State
+    SURFACE_STATE_TOKEN_COMMON      SurfaceToken;                                   // SurfaceS Token
+    int32_t                         iSurfStateID;                                   // Surface state ID
+    uint32_t                        dwSurfStateOffset;                              // Surface state offset (SSH)
+    uint32_t                        dwFormat;                                       // Surface format
+    uint32_t                        dwWidth;                                        // Surface width
+    uint32_t                        dwHeight;                                       // Surface heigth
+    uint32_t                        dwPitch;                                        // Surface pitch
+    uint32_t                        dwQPitch;                                       // Surface qpitch
+    uint32_t                        YUVPlane         :  2;                          // Plane
+    uint32_t                        bAVS             :  1;                          // AVS scaling
+    uint32_t                        bRenderTarget    :  1;                          // Render target flag
+    uint32_t                        bVertStride      :  1;                          // VL Stride
+    uint32_t                        bVertStrideOffs  :  1;                          // VL Stride Offset
+    uint32_t                        bWidthInDword    :  1;                          // Width in dwords
+    uint32_t                        bTiledSurface    :  1;                          // Tiled surface
+    uint32_t                        bTileWalk        :  1;                          // Walk 0-X; 1-Y
+    uint32_t                        bHalfPitchChroma :  1;                          // Half pitch for choma (AVS)
+    uint32_t                        bInterleaveChroma:  1;                          // Interleaved chroma (AVS)
+    uint32_t                        DirectionV       :  3;                          // UV direction         (AVS)
+    uint32_t                        DirectionU       :  1;                          // UV direction         (AVS)
+    uint32_t                        AddressControl   :  2;                          // 0 Clamp, 1 Mirror, 2, 3 resserved
+    uint32_t                                         : 15;                          // RESERVED
+    uint16_t                        wUXOffset;                                      // (X,Y) offset U (AVS/ADI)
+    uint16_t                        wUYOffset;                                      //
+    uint16_t                        wVXOffset;                                      // (X,Y) offset V (AVS/ADI)
+    uint16_t                        wVYOffset;                                      //
+} RENDERHAL_SURFACE_STATE_ENTRY, *PRENDERHAL_SURFACE_STATE_ENTRY;
+
+//!
+// \brief   Helper parameters used by Mhw_SendGenericPrologCmd and to initiate command buffer attributes
+//!
+typedef struct _RENDERHAL_GENERIC_PROLOG_PARAMS
+{
+    bool                            bMmcEnabled = 0;
+    bool                            bEnableMediaFrameTracking = 0;
+    uint32_t                        dwMediaFrameTrackingTag = 0;
+    uint32_t                        dwMediaFrameTrackingAddrOffset = 0;
+    PMOS_RESOURCE                   presMediaFrameTrackingSurface = nullptr;
+    virtual ~_RENDERHAL_GENERIC_PROLOG_PARAMS() {}
+} RENDERHAL_GENERIC_PROLOG_PARAMS, *PRENDERHAL_GENERIC_PROLOG_PARAMS;
+
+//!
+// \brief   Settings help to decide the value of L3 cache enabling register used for renderhal
+//!
+typedef struct _RENDERHAL_L3_CACHE_SETTINGS
+{
+    bool    bEnableSLM;     // Enable SLM cache configuration
+    bool    bOverride;      // Override cache settings
+
+    // Override values
+    bool    bL3CachingEnabled;
+
+    bool    bCntlRegOverride;
+    bool    bCntlReg2Override;
+    bool    bCntlReg3Override;
+    bool    bSqcReg1Override;
+    bool    bSqcReg4Override;
+    bool    bLra1RegOverride;
+
+    uint32_t dwCntlReg;
+    uint32_t dwCntlReg2;
+    uint32_t dwCntlReg3;
+    uint32_t dwSqcReg1;
+    uint32_t dwSqcReg4;
+    uint32_t dwLra1Reg;
+} RENDERHAL_L3_CACHE_SETTINGS, *PRENDERHAL_L3_CACHE_SETTINGS;
+
+//!
+// \brief   Settings of Predication
+//!
+typedef struct _RENDERHAL_PREDICATION_SETTINGS
+{
+    MOS_RESOURCE            *pPredicationResource;    // Resource for predication
+    MOS_RESOURCE            *ptempPredicationBuffer;  // Additional temp buffer for Predication due to the limitation of Cond_BB_End
+    uint64_t                predicationResOffset;     // Offset for Predication resource
+    bool                    predicationNotEqualZero;  // Predication mode
+    bool                    predicationEnabled;       // Indicates whether or not Predication is enabled
+} RENDERHAL_PREDICATION_SETTINGS;
+
+//!
+// \brief   Settings of SetMarker
+//!
+typedef struct _RENDERHAL_SETMARKER_SETTINGS
+{
+    MOS_RESOURCE            *pSetMarkerResource;      // Resource for SetMarker
+    bool                    setMarkerEnabled;         // Indicates whether or not SetMarker is enabled
+    uint32_t                setMarkerNumTs;           // Number Timestamp for SetMarker
+} RENDERHAL_SETMARKER_SETTINGS;
+
+typedef MhwMiInterface *PMHW_MI_INTERFACE;
+
+//!
+// \brief   Hardware dependent render engine interface
+//!
+typedef struct _RENDERHAL_INTERFACE
+{
+    // MOS/MHW Interfaces
+    PMOS_INTERFACE               pOsInterface;
+    MhwCpInterface               *pCpInterface;
+    PXMHW_STATE_HEAP_INTERFACE   pMhwStateHeap;
+    PMHW_MI_INTERFACE            pMhwMiInterface;
+
+    // RenderHal State Heap
+    PRENDERHAL_STATE_HEAP        pStateHeap;
+    uint32_t                     dwStateHeapSize;
+
+    // Linked list of batch buffers for synchronization
+    PMHW_BATCH_BUFFER            pBatchBufferList;                              // List of BB submitted
+
+    PMHW_MEMORY_POOL             pBatchBufferMemPool;                           // Batch Buffer memory allocations (malloc)
+    PMHW_BATCH_BUFFER_LIST       BatchBufferPool;                               // Pool of BB objects   (no GFX buffer)
+    PMHW_BATCH_BUFFER_LIST       BatchBuffersAllocated;                         // List of BB allocated (not executing, backed by GFX buffer)
+
+    // Auxiliary
+    PLATFORM                     Platform;
+    MEDIA_FEATURE_TABLE          *pSkuTable;
+    MEDIA_WA_TABLE               *pWaTable;
+
+    // Hardware dependent parameters
+    MHW_VFE_SCOREBOARD           VfeScoreboard;
+    PCMHW_SURFACE_PLANES         pPlaneDefinitions;
+
+    // Settings and capabilities
+    PMHW_RENDER_ENGINE_CAPS       pHwCaps;                                      // HW Capabilities
+    PMHW_RENDER_STATE_SIZES       pHwSizes;                                     // Sizes of HW commands/states
+    RENDERHAL_STATE_HEAP_SETTINGS StateHeapSettings;                            // State Heap Settings
+
+    // MHW parameters
+    MHW_STATE_BASE_ADDR_PARAMS   StateBaseAddressParams;
+    MHW_SIP_STATE_PARAMS         SipStateParams;
+    MHW_WALKER_MODE              MediaWalkerMode;                               // Media object walker mode from Regkey: repel, dual mode, quad mode
+
+    RENDERHAL_SURFACE_STATE_TYPE SurfaceTypeDefault;                            // Surface State type default
+    RENDERHAL_SURFACE_STATE_TYPE SurfaceTypeAdvanced;                           // Surface State type advanced
+
+    RENDERHAL_L3_CACHE_SETTINGS  L3CacheSettings;                               // L3 Cache settings
+
+    bool                        bEnableYV12SinglePass;                          // Enabled YV12 single pass in 3D sampler
+    bool                        bEnableP010SinglePass;                          // Enabled P010 single pass in sampler
+    bool                        bSIPKernel;                                     // SIP loaded
+    bool                        bCSRKernel;                                     // CSR loaded
+    bool                        bTurboMode;                                     // Turbo mode info to pass in cmdBuf
+    bool                        bVDIWalker;                                     // VDI Walker info from Regkey
+    bool                        bRequestSingleSlice;                            // Single Slice Request flag
+    bool                        bEUSaturationNoSSD;                             // No slice shutdown, must request 2 slices [CM EU saturation on]
+    bool                        bEnableGpgpuMidBatchPreEmption;                 // Middle Batch Buffer Preemption
+    bool                        bEnableGpgpuMidThreadPreEmption;                // Middle Thread Preemption
+    bool                        bComputeContextInUse;                           // Compute Context use for media
+
+    uint32_t                    dwMaskCrsThdConDataRdLn;                        // Unifies pfnSetupInterfaceDescriptor for g75,g8,...
+    uint32_t                    dwMinNumberThreadsInGroup;                      // Unifies pfnSetupInterfaceDescriptor for g75,g8,...
+    uint32_t                    dwCurbeBlockAlign;                              // Unifies pfnLoadCurbeData - Curbe Block Alignment
+    uint32_t                    dwScratchSpaceMaxThreads;                       // Unifies pfnGetScratchSpaceSize - Threads used for scratch space calculation
+    uint32_t                    dwSamplerAvsIncrement;                          // Unifies pfnSetSamplerStates
+
+    const void                  *sseuTable;                                     // pointer of const VphalSseuSetting table on a platform
+
+    uint32_t                    dwIndirectHeapSize;
+    uint32_t                    dwTimeoutMs;
+    int32_t                     iMaxPalettes;
+    int32_t                     iMaxPaletteEntries;
+    MHW_PALETTE_PARAMS          Palette[RENDERHAL_PALETTE_MAX];
+
+    int32_t                     iMaxChromaKeys;
+    int32_t                     iChromaKeyCount;
+    MHW_CHROMAKEY_PARAMS        ChromaKey[RENDERHAL_CHROMA_KEY_MAX];
+
+    bool                        bHasCombinedAVSSamplerState;
+
+    // GD2 kernel debugging
+    bool                        bIsaAsmDebugEnable;
+    uint8_t                     cIsaAsmDebugSurfaceBTI;
+    RENDERHAL_SURFACE           IsaAsmDebugSurface;
+
+    // Performance collection
+    bool                        bKerneltimeDump;
+    double                      kernelTime[RENDERHAL_COMPONENT_COUNT];
+
+    // Auxiliary data - for debugging purposes
+    int32_t                     iMediaStatesInUse;  // Media states in use
+    int32_t                     iKernelsInUse;      // Kernels in use
+    int32_t                     iBuffersInUse;      // BB in use
+
+    // Power option to control slice/subslice/EU shutdown
+    RENDERHAL_POWEROPTION       PowerOption;
+
+    // Indicates whether it's MDF load or not
+    bool                        IsMDFLoad;
+
+    bool                        bDynamicStateHeap;        //!< Indicates that DSH is in use
+
+
+    FrameTrackerProducer        trackerProducer;        // Resource to mark command buffer completion
+    RENDERHAL_TR_RESOURCE       veBoxTrackerRes;        // Resource to mark command buffer completion
+    uint32_t                    currentTrackerIndex;    // Record the tracker index
+
+    HeapManager                 *dgsheapManager;        // Dynamic general state heap manager
+
+#if (_DEBUG || _RELEASE_INTERNAL)
+    // Dump state for VP debugging
+    void                        *pStateDumper;
+#endif
+
+    // Pointer to vphal oca dumper object to dump vphal parameters.
+    void                        *pVphalOcaDumper;
+
+    // Predication
+    RENDERHAL_PREDICATION_SETTINGS PredicationParams;   //!< Predication
+    MOS_RESOURCE                   PredicationBuffer;   //!< Predication buffer
+
+    // CSC Coefficient
+    bool                           bCmfcCoeffUpdate;    //!< CMFC CSC Coefficient Surface update flag
+    int32_t                        iKernelAllocationID; //!< CMFC CSC Kernel Allocation ID
+    PMOS_RESOURCE                  pCmfcCoeffSurface;   //!< CMFC CSC Coefficient Surface
+
+    // SetMarker
+    RENDERHAL_SETMARKER_SETTINGS SetMarkerParams;   //!< SetMarker
+
+    // Indicates whether it's AVS or not
+    bool                        bIsAVS;
+
+    bool                        isMMCEnabled;
+
+    MediaPerfProfilerNext           *pPerfProfilerNext  = nullptr;  //!< Performance data profiler
+    bool                            eufusionBypass = false;
+
+    //---------------------------
+    // HW interface functions
+    //---------------------------
+    MOS_STATUS (* pfnInitialize)(
+                PRENDERHAL_INTERFACE     pRenderHal,
+                PRENDERHAL_SETTINGS      pSettings);
+
+    MOS_STATUS (* pfnDestroy) (
+                PRENDERHAL_INTERFACE     pRenderHal);
+
+    MOS_STATUS (* pfnReset) (
+                PRENDERHAL_INTERFACE     pRenderHal);
+
+    //---------------------------
+    // State Heap Functions
+    //---------------------------
+    MOS_STATUS (* pfnAllocateStateHeaps) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                PRENDERHAL_STATE_HEAP_SETTINGS  pSettings);
+
+    MOS_STATUS (* pfnReAllocateStateHeapsforAdvFeature) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                bool                            &bAllocated);
+
+    MOS_STATUS (* pfnFreeStateHeaps) (
+                PRENDERHAL_INTERFACE     pRenderHal);
+
+    MOS_STATUS (* pfnRefreshSync) (
+                PRENDERHAL_INTERFACE     pRenderHal);
+
+    //---------------------------
+    // SSH, surface states
+    //---------------------------
+    MOS_STATUS (* pfnAssignSshInstance) (
+                PRENDERHAL_INTERFACE    pRenderHal);
+
+    MOS_STATUS (* pfnGetSurfaceStateEntries) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                PRENDERHAL_SURFACE              pRenderHalSurface,
+                PRENDERHAL_SURFACE_STATE_PARAMS pParams,
+                int32_t                         *piNumEntries,
+                PRENDERHAL_SURFACE_STATE_ENTRY  *ppSurfaceEntries);
+
+    MOS_STATUS (* pfnSetupSurfaceState) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                PRENDERHAL_SURFACE              pRenderHalSurface,
+                PRENDERHAL_SURFACE_STATE_PARAMS pParams,
+                int32_t                         *piNumEntries,
+                PRENDERHAL_SURFACE_STATE_ENTRY  *ppSurfaceEntries,
+                PRENDERHAL_OFFSET_OVERRIDE      pOffsetOverride);
+
+    MOS_STATUS (*pfnSetupBufferSurfaceState) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                PRENDERHAL_SURFACE              pRenderHalSurface,
+                PRENDERHAL_SURFACE_STATE_PARAMS pParams,
+                PRENDERHAL_SURFACE_STATE_ENTRY  *ppSurfaceEntry);
+
+    MOS_STATUS (* pfnAssignSurfaceState) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                RENDERHAL_SURFACE_STATE_TYPE    Type,
+                PRENDERHAL_SURFACE_STATE_ENTRY  *ppSurfaceEntry);
+
+    void (* pfnGetAlignUnit) (
+                uint16_t                        *pwWidthAlignUnit,
+                uint16_t                        *pwHeightAlignUnit,
+                PRENDERHAL_SURFACE              pRenderHalSurface);
+
+    void (* pfnAdjustBoundary) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                PRENDERHAL_SURFACE              pRenderHalSurface,
+                RENDERHAL_SS_BOUNDARY           Boundary,
+                uint32_t                        *pdwSurfaceWidth,
+                uint32_t                        *pdwSurfaceHeight);
+
+    uint32_t (* pfnSetSurfacesPerBT) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                uint32_t                        dwSurfacesPerBT);
+
+    uint16_t (* pfnCalculateYOffset) (
+                PMOS_INTERFACE                  pOsInterface, 
+                PMOS_RESOURCE                   pOsResource);
+
+    MOS_STATUS (* pfnAssignBindingTable) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                int32_t                         *piBindingTable);
+
+    MOS_STATUS (* pfnBindSurfaceState) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                int32_t                         iBindingTableIndex,
+                int32_t                         iBindingTableEntry,
+                PRENDERHAL_SURFACE_STATE_ENTRY  pSurfaceEntry);
+
+    uint32_t (* pfnGetSurfaceMemoryObjectControl) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                PRENDERHAL_SURFACE_STATE_PARAMS pParams);
+
+    //---------------------------
+    // State Setup - HW + OS Specific
+    //---------------------------
+    MOS_STATUS (* pfnSetupSurfaceStatesOs) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                PRENDERHAL_SURFACE_STATE_PARAMS pParams,
+                PRENDERHAL_SURFACE_STATE_ENTRY  pSurfaceStateEntry);
+
+    //---------------------------
+    // Batch Buffer
+    //---------------------------
+    MOS_STATUS (* pfnAllocateBB) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMHW_BATCH_BUFFER           pBatchBuffer,
+                int32_t                     iSize);
+
+    MOS_STATUS (* pfnFreeBB) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMHW_BATCH_BUFFER           pBatchBuffer);
+
+    MOS_STATUS (* pfnLockBB) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMHW_BATCH_BUFFER           pBatchBuffer);
+
+    MOS_STATUS (* pfnUnlockBB) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMHW_BATCH_BUFFER           pBatchBuffer);
+
+    //---------------------------
+    // Media State
+    //---------------------------
+    PRENDERHAL_MEDIA_STATE (* pfnAssignMediaState) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                RENDERHAL_COMPONENT         componentID);
+
+    //---------------------------
+    // Allocation
+    //---------------------------
+    MOS_STATUS (* pfnEnablePalette) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     iPaletteID,
+                int32_t                     iPaletteSize);
+
+    MOS_STATUS (* pfnAllocatePaletteID) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     *pPaletteID);
+
+    MOS_STATUS (* pfnFreePaletteID) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     *pPaletteID);
+
+    MOS_STATUS (* pfnGetPaletteEntry) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     iPaletteID,
+                int32_t                     iInNumEntries,
+                int32_t                     *piOutNumEntries,
+                void                        **pPaletteData);
+
+    int32_t (* pfnAllocateChromaKey) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                uint32_t                    dwLow,
+                uint32_t                    dwHigh);
+
+    int32_t (* pfnLoadCurbeData) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PRENDERHAL_MEDIA_STATE      pMediaState,
+                void                        *pData,
+                int32_t                     iSize);
+
+    MOS_STATUS (* pfnSetSamplerStates) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     iMediaID,
+                PMHW_SAMPLER_STATE_PARAM    pSamplerParams,
+                int32_t                     iSamplers);
+
+    int32_t (* pfnAllocateMediaID) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     iKernelAllocationID,
+                int32_t                     iBindingTableID,
+                int32_t                     iCurbeOffset,
+                int32_t                     iCurbeLength,
+                int32_t                     iCrsThrdConstDataLn,
+                PMHW_GPGPU_WALKER_PARAMS    pGpGpuWalkerParams);
+
+    int32_t (* pfnGetMediaID) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PRENDERHAL_MEDIA_STATE      pMediaState,
+                PRENDERHAL_KRN_ALLOCATION   pKernelAllocation);
+
+    MOS_STATUS (* pfnSetupInterfaceDescriptor) (
+                PRENDERHAL_INTERFACE                   pRenderHal,
+                PRENDERHAL_MEDIA_STATE                 pMediaState,
+                PRENDERHAL_KRN_ALLOCATION              pKernelAllocation,
+                PRENDERHAL_INTERFACE_DESCRIPTOR_PARAMS pInterfaceDescriptorParams);
+
+    uint32_t (* pfnEncodeSLMSize)(PRENDERHAL_INTERFACE pRenderHal, uint32_t SLMSize);
+
+    //---------------------------
+    // Kernels
+    //---------------------------
+    int32_t (* pfnLoadKernel) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PCRENDERHAL_KERNEL_PARAM    pParameters,
+                PMHW_KERNEL_PARAM           pKernel,
+                Kdll_CacheEntry             *pKernelEntry);
+
+    MOS_STATUS (* pfnUnloadKernel) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     iKernelAllocationID);
+
+    void (* pfnResetKernels) (
+                PRENDERHAL_INTERFACE        pRenderHal);
+
+    void (* pfnTouchKernel) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     iKernelAllocationID);
+
+    int32_t (* pfnGetKernelOffset) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     iKernelAllocationIndex);
+
+    MOS_STATUS (* pfnUnregisterKernel) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PRENDERHAL_KRN_ALLOCATION   pKernelAllocation);
+
+    //---------------------------
+    // New Dynamic State Heap interfaces
+    //---------------------------
+    MOS_STATUS(*pfnAssignSpaceInStateHeap)(
+        uint32_t              trackerIndex,
+        FrameTrackerProducer  *trackerProducer,
+        HeapManager           *heapManager,
+        MemoryBlock           *block,
+        uint32_t               size);
+
+    PRENDERHAL_MEDIA_STATE (* pfnAssignDynamicState) (
+                PRENDERHAL_INTERFACE                  pRenderHal,
+                PRENDERHAL_DYNAMIC_MEDIA_STATE_PARAMS pParams,
+                RENDERHAL_COMPONENT                   componentID);
+
+    MOS_STATUS (* pfnReleaseDynamicState) (
+                PRENDERHAL_INTERFACE                  pRenderHal,
+                PRENDERHAL_MEDIA_STATE                pMediaState);
+
+    MOS_STATUS (* pfnSubmitDynamicState) (
+                PRENDERHAL_INTERFACE                  pRenderHal,
+                PRENDERHAL_MEDIA_STATE                pMediaState);
+
+    int32_t (* pfnAllocateDynamicMediaID) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PRENDERHAL_KRN_ALLOCATION   pKernelAllocation,
+                int32_t                     iBindingTableID,
+                int32_t                     iCurbeOffset,
+                int32_t                     iCurbeLength,
+                int32_t                     iCrsThrdConstDataLn,
+                PMHW_GPGPU_WALKER_PARAMS    pGpGpuWalkerParams);
+
+    PRENDERHAL_KRN_ALLOCATION (* pfnLoadDynamicKernel) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PCRENDERHAL_KERNEL_PARAM    pParameters,
+                PMHW_KERNEL_PARAM           pKernel,
+                uint32_t                    *pdwLoaded);
+
+    PRENDERHAL_KRN_ALLOCATION (* pfnSearchDynamicKernel) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     iKernelUniqueID,
+                int32_t                     iCacheID);
+
+    PRENDERHAL_KRN_ALLOCATION (* pfnAllocateDynamicKernel) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     iKernelUniqueID,
+                int32_t                     iCacheID);
+
+    MOS_STATUS (* pfnUnloadDynamicKernel) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PRENDERHAL_KRN_ALLOCATION   pKernelAllocation);
+
+    MOS_STATUS (* pfnRefreshDynamicKernels) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                uint32_t                    dwSpaceNeeded,
+                uint32_t                    *pdwSizes,
+                int32_t                     iCount);
+
+    void (* pfnResetDynamicKernels) (
+                PRENDERHAL_INTERFACE        pRenderHal);
+
+    void (* pfnTouchDynamicKernel) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PRENDERHAL_KRN_ALLOCATION   pKernelAllocation);
+
+    MOS_STATUS (* pfnExpandKernelStateHeap)(
+                PRENDERHAL_INTERFACE        pRenderHal,
+        uint32_t                            dwAdditionalKernelSpaceNeeded);
+
+    //---------------------------
+    // HW interface configuration functions
+    //---------------------------
+    MOS_STATUS (* pfnSetVfeStateParams) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                uint32_t                    dwDebugCounterControl,
+                uint32_t                    dwMaximumNumberofThreads,
+                uint32_t                    dwCURBEAllocationSize,
+                uint32_t                    dwURBEntryAllocationSize,
+                PMHW_VFE_SCOREBOARD         pScoreboardParams);
+
+    bool (* pfnGetMediaWalkerStatus) (
+                PRENDERHAL_INTERFACE        pRenderHal);
+
+    //---------------------------
+    // Command buffer programming functions
+    //---------------------------
+    MOS_STATUS (* pfnSendStateBaseAddress) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMOS_COMMAND_BUFFER         pCmdBuffer);
+
+    MOS_STATUS (* pfnSendMediaStates) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMOS_COMMAND_BUFFER         pCmdBuffer,
+                PMHW_WALKER_PARAMS          pWalkerParams,
+                PMHW_GPGPU_WALKER_PARAMS    pGpGpuWalkerParams);
+
+    MOS_STATUS (* pfnInitCommandBuffer) (
+                PRENDERHAL_INTERFACE                pRenderHal,
+                PMOS_COMMAND_BUFFER                 pCmdBuffer,
+                PRENDERHAL_GENERIC_PROLOG_PARAMS    pGenericPrologParams);
+
+    MOS_STATUS (* pfnSendSurfaces) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMOS_COMMAND_BUFFER         pCmdBuffer);
+
+    MOS_STATUS (* pfnSendSyncTag) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMOS_COMMAND_BUFFER         pCmdBuffer);
+
+    MOS_STATUS (*pfnSendCscCoeffSurface) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMOS_COMMAND_BUFFER         pCmdBuffer,
+                PMOS_RESOURCE               presCscCoeff,
+                Kdll_CacheEntry             *pKernelEntry);
+
+    // Samplers and other states
+    MOS_STATUS (*pfnGetSamplerOffsetAndPtr) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                int32_t                     iMediaID,
+                int32_t                     iSamplerID,
+                PMHW_SAMPLER_STATE_PARAM    pSamplerParams,
+                uint32_t                    *pdwSamplerOffset,
+                void                        **ppSampler);
+
+    MOS_STATUS (* pfnSendCurbeLoad) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMOS_COMMAND_BUFFER         pCmdBuffer);
+
+    MOS_STATUS (* pfnSendMediaIdLoad) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMOS_COMMAND_BUFFER         pCmdBuffer);
+
+    MOS_STATUS (* pfnSendChromaKey) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMOS_COMMAND_BUFFER         pCmdBuffer);
+
+    MOS_STATUS (* pfnSendPalette) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMOS_COMMAND_BUFFER         pCmdBuffer);
+
+    MOS_STATUS (* pfnSendSurfaceStateEntry) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                PMOS_COMMAND_BUFFER             pCmdBuffer,
+                PMHW_SURFACE_STATE_SEND_PARAMS  pParams);
+
+    MOS_STATUS (* pfnSetSurfaceStateToken)(
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMHW_SURFACE_TOKEN_PARAMS   pParams,
+                void                        *pSurfaceStateToken);
+
+    MOS_STATUS (* pfnSetSurfaceStateBuffer)(
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PMHW_RCS_SURFACE_PARAMS     pParams,
+                void                        *pSurfaceState);
+
+    //-----------------------------
+    // Slice Shutdown Mode function
+    //-----------------------------
+    void (* pfnSetSliceShutdownMode) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                bool                        bMode);
+
+    //-----------------------------
+    // General Slice Shut Down Mode function
+    //-----------------------------
+    void( *pfnSetPowerOptionMode ) (
+        PRENDERHAL_INTERFACE                pRenderHal,
+        PRENDERHAL_POWEROPTION              pMode);
+
+    //-----------------------------
+    // Enable Middle Batch Buffer Preemption
+    //-----------------------------
+    void (* pfnEnableGpgpuMiddleBatchBufferPreemption) (
+                PRENDERHAL_INTERFACE        pRenderHal);
+
+    //-----------------------------
+    // Enable Middle Thread Preemption
+    //-----------------------------
+    void (* pfnEnableGpgpuMiddleThreadPreemption) (
+                PRENDERHAL_INTERFACE        pRenderHal);
+
+    //---------------------------
+    // Generic HAL Layer Commands and State Functions
+    //---------------------------
+    void (* pfnConvertToNanoSeconds) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                uint64_t                    iTicks,
+                uint64_t                    *piNs);
+
+    MOS_STATUS (* pfnSendRcsStatusTag) (
+               PRENDERHAL_INTERFACE         pRenderHal,                                             // [in] Hardware interface
+               PMOS_COMMAND_BUFFER          pCmdBuffer);                                            // [in] Command Buffer
+
+    MOS_STATUS (* pfnSendTimingData) (
+                PRENDERHAL_INTERFACE        pRenderHal,                                             // [in] Hardware interface
+                PMOS_COMMAND_BUFFER         pCmdBuffer,                                             // [in] Command Buffer
+                bool                        bStartTime);                                            // [in] Start Timestamp flag
+
+    uint32_t (* pfnGetScratchSpaceSize)(
+               PRENDERHAL_INTERFACE         pRenderHal,                                             // [in] Hardware interface
+               uint32_t                     iPerThreadScratchSpaceSize);                            // [in] Per thread scrach space size
+
+    bool (* pfnIs2PlaneNV12Needed) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PRENDERHAL_SURFACE          pRenderHalSurface,
+                RENDERHAL_SS_BOUNDARY       Boundary);
+
+    uint8_t (* pfnSetChromaDirection) (
+                PRENDERHAL_INTERFACE        pRenderHal,
+                PRENDERHAL_SURFACE          pRenderHalSurface);
+
+    bool(*pfnPerThreadScratchSpaceStart2K) (
+                PRENDERHAL_INTERFACE        pRenderHal);
+
+    //---------------------------
+    // Overwrite L3 Cache control register
+    //---------------------------
+    MOS_STATUS (* pfnEnableL3Caching) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                PRENDERHAL_L3_CACHE_SETTINGS    pCacheSettings);
+
+    MOS_STATUS(*pfnSetCacheOverrideParams) (
+                PRENDERHAL_INTERFACE            pRenderHal,
+                PRENDERHAL_L3_CACHE_SETTINGS    pCacheSettings,
+                bool                            bEnableSLM);
+
+    //!
+    //! \brief    Get mmio registers address
+    //! \details  Get mmio registers address
+    //! \return   [out] PMHW_MI_MMIOREGISTERS*
+    //!           mmio registers got.
+    //!
+    PMHW_MI_MMIOREGISTERS GetMmioRegisters();
+
+    //-----------------------------
+    //Platform related interface
+    XRenderHal_Platform_Interface           *pRenderHalPltInterface;
+} RENDERHAL_INTERFACE;
+
+//!
+//! \brief   Functions
+//!
+
+//!
+//! \brief    Init Interface
+//! \details  Initializes Render Hal Interface structure, responsible for HW
+//!           abstraction of Render Engine for MDF/VP
+//! \param    PRENDERHAL_INTERFACE pRenderHal
+//!           [in] Pointer to Hardware Interface Structure
+//! \param    MhwCpInterface** ppCpInterface
+//!           [in/out] Pointer of pointer to MHW CP Interface Structure, which 
+//!           is created during renderhal initialization
+//! \param    PMOS_INTERFACE pOsInterface
+//!           [in] Pointer to OS Interface Structure
+//! \return   MOS_STATUS
+//!           MOS_STATUS_UNKNOWN : Invalid parameters
+//!
+MOS_STATUS RenderHal_InitInterface(
+    PRENDERHAL_INTERFACE        pRenderHal,
+    MhwCpInterface              **ppCpInterface,
+    PMOS_INTERFACE              pOsInterface);
+
+//!
+//! \brief    Get Pixels Per Sample
+//! \details  Get Number of Pixels per Dataport Sample
+//! \param    MOS_FORMAT format
+//!           [in] Surface Format
+//! \param    uint32_t *pdwPixelsPerSampleUV
+//!           [in] Pointer to dwPixelsPerSampleUV
+//! \return   void
+//!
+void RenderHal_GetPixelsPerSample(
+    MOS_FORMAT                  format,
+    uint32_t                    *pdwPixelsPerSampleUV);
+
+//!
+//! \brief    Set Surface for HW Access
+//! \details  Common Function for setting up surface state
+//! \param    PRENDERHAL_INTERFACE pRenderHal
+//!           [in] Pointer to Hardware Interface Structure
+//! \param    PRENDERHAL_SURFACE pRenderHalSurface
+//!           [in] Pointer to Render Hal Surface
+//! \param    PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams
+//!           [in] Pointer to Surface Params
+//! \param    int32_t iBindingTable
+//!           [in] Binding Table to bind surface
+//! \param    int32_t iBTEntry
+//!           [in] Binding Table Entry index
+//! \param    bool bWrite
+//!           [in] Write mode flag
+//! \return   MOS_STATUS
+//!           MOS_STATUS_SUCCESS if success. Error code otherwise
+//!
+MOS_STATUS RenderHal_SetSurfaceForHwAccess(
+    PRENDERHAL_INTERFACE            pRenderHal,
+    PRENDERHAL_SURFACE              pRenderHalSurface,
+    PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams,
+    int32_t                         iBindingTable,
+    int32_t                         iBTEntry,
+    bool                            bWrite);
+
+//!
+//! \brief    Set Buffer Surface for HW Access
+//! \details  Common Function for setting up buffer surface state
+//! \param    PRENDERHAL_INTERFACE pRenderHal
+//!           [in] Pointer to Hardware Interface Structure
+//! \param    PRENDERHAL_SURFACE pRenderHalSurface
+//!           [in] Pointer to Render Hal Surface
+//! \param    PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams
+//!           [in] Pointer to Surface Params
+//! \param    int32_t iBindingTable
+//!           [in] Binding Table to Bind Surface
+//! \param    int32_t iBTEntry
+//!           [in] Binding Table Entry index
+//! \param    bool bWrite
+//!           Write mode flag
+//! \return   MOS_STATUS
+//!           MOS_STATUS_SUCCESS if success. Error code otherwise
+//!
+MOS_STATUS RenderHal_SetBufferSurfaceForHwAccess(
+    PRENDERHAL_INTERFACE            pRenderHal,
+    PRENDERHAL_SURFACE              pRenderHalSurface,
+    PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams,
+    int32_t                         iBindingTable,
+    int32_t                         iBTEntry,
+    bool                            bWrite);
+
+//!
+//! \brief    Get Surface Info from OsResource
+//! \details  Update surface info in PRENDERHAL_SURFACE based on allocated OsResource
+//! \param    PMOS_INTERFACE pOsInterface
+//!           [in] Pointer to MOS_INTERFACE
+//! \param    PRENDERHAL_GET_SURFACE_INFO pInfo
+//!           [in] Pointer to RENDERHAL_GET_SURFACE_INFO
+//! \param    PMOS_SURFACE pSurface
+//!           [in/out] Pointer to PMOS_SURFACE
+//! \return   MOS_STATUS
+//!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
+//!
+MOS_STATUS RenderHal_GetSurfaceInfo(
+    PMOS_INTERFACE              pOsInterface,
+    PRENDERHAL_GET_SURFACE_INFO pInfo,
+    PMOS_SURFACE                pSurface);
+
+//!
+//! \brief    Send Media States
+//! \details  Send Media States
+//! \param    PRENDERHAL_INTERFACE pRenderHal
+//!           [in] Pointer to Hardware Interface Structure
+//! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+//!           [in] Pointer to Command Buffer
+//! \param    PRENDERHAL_GPGPU_WALKER_PARAMS pGpGpuWalkerParams
+//!           [in]    Pointer to GPGPU walker parameters
+//! \return   MOS_STATUS
+//!
+MOS_STATUS RenderHal_SendMediaStates(
+    PRENDERHAL_INTERFACE      pRenderHal,
+    PMOS_COMMAND_BUFFER       pCmdBuffer,
+    PMHW_WALKER_PARAMS        pWalkerParams,
+    PMHW_GPGPU_WALKER_PARAMS  pGpGpuWalkerParams);
+
+//!
+//! \brief    Issue command to write timestamp
+//! \param    [in] pRenderHal
+//! \param    [in] pCmdBuffer
+//! \param    [in] bStartTime
+//! \return   MOS_STATUS
+//!
+MOS_STATUS RenderHal_SendTimingData(
+    PRENDERHAL_INTERFACE         pRenderHal,
+    PMOS_COMMAND_BUFFER          pCmdBuffer,
+    bool                         bStartTime);
+
+//!
+//! \brief    Get Y Offset according to the planeOffset struct and surface pitch
+//! \details  Get Y Offset according to the planeOffset struct and surface pitch
+//! \param    pOsInterface
+//!           [in] pointer to OS Interface
+//! \param    pOsResource
+//!           [in] Pointers to Surface OsResource
+//! \return   uint16_t
+//!           [out] the plane Y offset
+//!
+uint16_t RenderHal_CalculateYOffset(
+    PMOS_INTERFACE      pOsInterface, 
+    PMOS_RESOURCE       pOsResource);
+
+MOS_STATUS RenderHal_AllocateDebugSurface(
+    PRENDERHAL_INTERFACE    pRenderHal);
+
+MOS_STATUS RenderHal_SetupDebugSurfaceState(
+    PRENDERHAL_INTERFACE    pRenderHal);
+
+void RenderHal_FreeDebugSurface(
+    PRENDERHAL_INTERFACE    pRenderHal);
+
+MOS_STATUS RenderHal_AddDebugControl(
+    PRENDERHAL_INTERFACE    pRenderHal,
+    PMOS_COMMAND_BUFFER     pCmdBuffer);
+
+
+MOS_STATUS RenderHal_SetSurfaceStateToken(
+    PRENDERHAL_INTERFACE        pRenderHal,
+    PMHW_SURFACE_TOKEN_PARAMS   pParams,
+    void                        *pSurfaceStateToken);
+
+//!
+//! \brief    Send Surfaces PatchList
+//! \details  Send Surface State commands
+//! \param    PRENDERHAL_INTERFACE pRenderHal
+//!           [in] Pointer to Hardware Interface Structure
+//! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+//!           [in] Pointer to Command Buffer
+//! \return   MOS_STATUS
+//!
+MOS_STATUS RenderHal_SendSurfaces_PatchList(
+    PRENDERHAL_INTERFACE    pRenderHal,
+    PMOS_COMMAND_BUFFER     pCmdBuffer);
+
+//!
+//! \brief    Init Special Interface
+//! \details  Initializes RenderHal Interface structure, responsible for HW
+//!           abstraction of HW Rendering Engine for CM(MDF) and VP.
+//! \param    PRENDERHAL_INTERFACE pRenderHal
+//!           [in] Pointer to RenderHal Interface Structure
+//!
+void RenderHal_InitInterfaceEx(
+    PRENDERHAL_INTERFACE    pRenderHal);
+
+// Constants defined in RenderHal interface
+extern const SURFACE_STATE_TOKEN_COMMON   g_cInit_SURFACE_STATE_TOKEN_COMMON;
+extern const MHW_PIPE_CONTROL_PARAMS      g_cRenderHal_InitPipeControlParams;
+extern const MHW_VFE_PARAMS               g_cRenderHal_InitVfeParams;
+extern const MHW_MEDIA_STATE_FLUSH_PARAM  g_cRenderHal_InitMediaStateFlushParams;
+extern const RENDERHAL_KERNEL_PARAM       g_cRenderHal_InitKernelParams;
+
+#endif // __RENDERHAL_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/renderhal/renderhal_platform_interface.h 22.5.1+ds1-1/media_common/agnostic/common/renderhal/renderhal_platform_interface.h
--- 22.4.3+ds1-1/media_common/agnostic/common/renderhal/renderhal_platform_interface.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/renderhal/renderhal_platform_interface.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,698 @@
+/*
+* Copyright (c) 2009-2021, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file      renderhal_platform_interface.h 
+//! \brief     abstract the platfrom specific APIs into one class 
+//!
+//!
+//! \file     renderhal_platform_interface.h 
+//! \brief    Render Engine Interfaces shared across platforms
+//! \details  Platform Independent Hardware Interfaces
+//!
+#ifndef __RENDERHAL_PLATFORM_INTERFACE_H__
+#define __RENDERHAL_PLATFORM_INTERFACE_H__
+
+#include "mos_os.h"
+#include "renderhal.h"
+
+class XRenderHal_Platform_Interface
+{
+public:
+    XRenderHal_Platform_Interface() {}
+    virtual ~XRenderHal_Platform_Interface() {}
+
+    //!
+    //! \brief    Setup Surface State
+    //! \details  Setup Surface States
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to Hardware Interface Structure
+    //! \param    PRENDERHAL_SURFACE pRenderHalSurface
+    //!           [in] Pointer to Render Hal Surface
+    //! \param    PRENDERHAL_SURFACE_STATE_PARAMS pParams
+    //!           [in] Pointer to Surface State Params
+    //! \param    int32_t *piNumEntries
+    //!           [out] Pointer to Number of Surface State Entries (Num Planes)
+    //! \param    PRENDERHAL_SURFACE_STATE_ENTRY * ppSurfaceEntries
+    //!           [out] Array of Surface State Entries
+    //! \param    PRENDERHAL_OFFSET_OVERRIDE pOffsetOverride
+    //!           [in] If not nullptr, provides adjustments to Y, UV plane offsets,
+    //!           used for kernel in a few cases. nullptr is the most common usage.
+    //! \return   MOS_STATUS
+    //!
+    virtual MOS_STATUS SetupSurfaceState(
+        PRENDERHAL_INTERFACE            pRenderHal,
+        PRENDERHAL_SURFACE              pRenderHalSurface,
+        PRENDERHAL_SURFACE_STATE_PARAMS pParams,
+        int32_t                         *piNumEntries,
+        PRENDERHAL_SURFACE_STATE_ENTRY  *ppSurfaceEntries,
+        PRENDERHAL_OFFSET_OVERRIDE      pOffsetOverride) = 0;
+
+    //!
+    //! \brief    Check if Sampler128Elements is supported
+    //! \return   true of false
+    //!
+    virtual bool IsSampler128ElementsSupported() = 0;
+
+    //!
+    //! \brief      Checks how per thread scratch space size bits in VFE state are interpreted by HW
+    //! \details    For BDW GT1/2/3 A0 steppings, per thread scratch space size in VFE state
+    //!             is 11 bits indicating [2k bytes, 2 Mbytes]: 0=2k, 1=4k, 2=8k ... 10=2M
+    //!             BDW+ excluding A0 step is 12 bits indicating [1k bytes, 2 Mbytes]: 0=1k, 1=2k, 2=4k, 3=8k ... 11=2M
+    //! \param      PRENDERHAL_INTERFACE pRenderHal
+    //!             [in]    Pointer to RenderHal interface
+    //! \return     true if BDW A0 stepping, false otherwise
+    //!
+    virtual bool PerThreadScratchSpaceStart2K(
+        PRENDERHAL_INTERFACE pRenderHal) = 0;
+
+    //!
+    //! \brief      Checks how per thread scratch space size bits in VFE state are interpreted by HW
+    //! \details    On some new platforms, per thread scratch space size can be 2^n (n >= 6) bytes.
+    //!             If this is supported, total scratch space size can be reduced.
+    //! \return     64-byte base size is supported on specific platforms, so false is returned in
+    //!             base class implementation.
+    //!
+    virtual bool PerThreadScratchSpaceStart64Byte(
+        RENDERHAL_INTERFACE *renderHal) { return false; }
+
+    //!
+    //! \brief    Encode SLM Size for Interface Descriptor
+    //! \details  Setup SLM size
+    //! \param    uint32_t SLMSize
+    //!           [in] SLM size in 1K
+    //! \return   encoded output
+    //!
+    virtual uint32_t EncodeSLMSize(uint32_t SLMSize) = 0;
+
+    //!
+    //! \brief    Set Chroma Direction
+    //! \details  Setup Chroma Direction
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in]  Pointer to Hardware Interface
+    //! \param    PRENDERHAL_SURFACE pRenderHalSurface
+    //!           [in]  Pointer to Render Hal Surface
+    //! \return   uint8_t
+    //!
+    virtual uint8_t SetChromaDirection(
+        PRENDERHAL_INTERFACE pRenderHal,
+        PRENDERHAL_SURFACE   pRenderHalSurface) = 0;
+
+    //!
+    //! \brief    Convert To Nano Seconds
+    //! \details  Convert to Nano Seconds
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to Hardware Interface Structure
+    //! \param    uint64_t iTicks
+    //!           [in] Ticks
+    //! \param    uint64_t *piNs
+    //!           [in] Nano Seconds
+    //! \return   void
+    //!
+    virtual void ConvertToNanoSeconds(
+        PRENDERHAL_INTERFACE    pRenderHal,
+        uint64_t                iTicks,
+        uint64_t                *piNs) = 0;
+
+    //!
+    //! \brief    Initialize the State Heap Settings per platform
+    //! \param    PRENDERHAL_INTERFACE    pRenderHal
+    //!           [out] Pointer to PRENDERHAL_INTERFACE
+    //! \return   void
+    //!
+    virtual void InitStateHeapSettings(
+        PRENDERHAL_INTERFACE    pRenderHal) = 0;
+
+    //!
+    //! \brief    Initialize the default surface type and advanced surface type  per platform
+    //! \param    PRENDERHAL_INTERFACE    pRenderHal
+    //!           [out] Pointer to PRENDERHAL_INTERFACE
+    //! \return   void
+    //!
+    virtual void InitSurfaceTypes(
+        PRENDERHAL_INTERFACE    pRenderHal) = 0;
+
+    //!
+    //! \brief    Check if YV12 Single Pass is supported
+    //! \param    PRENDERHAL_INTERFACE    pRenderHal
+    //!           [in]  Pointer to Hardware Interface
+    //! \return   true of false
+    //!
+    virtual bool IsEnableYV12SinglePass(
+        PRENDERHAL_INTERFACE    pRenderHal) = 0;
+
+    //!
+    //! \brief     Get the Size of AVS Sampler State
+    //! \param    PRENDERHAL_INTERFACE    pRenderHal
+    //!           [in]  Pointer to Hardware Interface
+    //! \return   size
+    //!
+    virtual uint32_t GetSizeSamplerStateAvs(
+        PRENDERHAL_INTERFACE    pRenderHal) = 0;
+
+    //!
+    //! \brief    Enables L3 cacheing flag and sets related registers/values
+    //! \param    PRENDERHAL_INTERFACE    pRenderHal
+    //!           [in]  Pointer to Hardware Interface
+    //! \param    pCacheSettings
+    //!           [in] L3 Cache Configurations
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS EnableL3Caching(
+        PRENDERHAL_INTERFACE         pRenderHal,
+        PRENDERHAL_L3_CACHE_SETTINGS pCacheSettings) = 0;
+
+    //!
+    //! \brief    Get offset and/or pointer to sampler state
+    //! \details  Get offset and/or pointer to sampler state in General State Heap
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface
+    //! \param    int32_t iMediaID
+    //!           [in] Media ID associated with sampler
+    //! \param    int32_t iSamplerID
+    //!           [in] Sampler ID
+    //! \param    uint32_t *pdwSamplerOffset
+    //!           [out] optional; offset of sampler state from GSH base
+    //! \param    void  **ppSampler
+    //!           [out] optional; pointer to sampler state in GSH
+    //! \return   MOS_STATUS
+    //!
+    virtual MOS_STATUS GetSamplerOffsetAndPtr_DSH(
+        PRENDERHAL_INTERFACE     pRenderHal,
+        int32_t                  iMediaID,
+        int32_t                  iSamplerID,
+        PMHW_SAMPLER_STATE_PARAM pSamplerParams,
+        uint32_t                 *pdwSamplerOffset,
+        void                    **ppSampler)
+    {
+        return MOS_STATUS_SUCCESS;
+    }
+
+    //!
+    //! \brief      Initialize the DSH Settings
+    //! \details    Initialize the structure DynamicHeapSettings in pRenderHal
+    //! \param      PRENDERHAL_INTERFACE pRenderHal
+    //!             [in]    Pointer to HW interface
+    //! \return     void
+    //!
+    virtual void InitDynamicHeapSettings(
+        PRENDERHAL_INTERFACE  pRenderHal)
+    {
+    }
+
+    //!
+    //! \brief      Get the depth bit mask for buffer 
+    //! \details    Get the depth bit mask for buffer 
+    //! \return     uint32_t
+    //!             depth bit mask for buffer 
+    //!
+    virtual uint32_t GetDepthBitMaskForBuffer() { return MOS_MASKBITS32(21, 29); };
+
+    //!
+    //! \brief      Get the depth bit mask for raw buffer 
+    //! \details    Get the depth bit mask for raw buffer 
+    //! \return     uint32_t
+    //!             depth bit mask for raw buffer 
+    //!
+    virtual uint32_t GetDepthBitMaskForRawBuffer() { return MOS_MASKBITS32(21, 29);};
+
+    //!
+    //! \brief      Get the pointer to the MHW_VFE_PARAMS
+    //! \return     MHW_VFE_PARAMS*
+    //!             pointer to the MHW_VFE_PARAMS
+    //!
+    virtual MHW_VFE_PARAMS* GetVfeStateParameters() = 0;
+
+    //!
+    //! \brief      Get the size of render hal media state
+    //! \return     size_t
+    //!             The size of render hal media state
+    //!
+    virtual size_t GetRenderHalMediaStateSize() = 0;
+
+    //!
+    //! \brief      Get the size of render hal state heap
+    //! \return     size_t
+    //!             The size of render hal state heap
+    //!
+    virtual size_t GetRenderHalStateHeapSize() = 0;
+
+    //!
+    //! \brief    Set Power Option Status
+    //! \param    [in] pRenderHal
+    //!           Pointer to Hardware Interface
+    //! \param    [in,out] pCmdBuffer
+    //!           Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS SetPowerOptionStatus(
+        PRENDERHAL_INTERFACE         pRenderHal,
+        PMOS_COMMAND_BUFFER          pCmdBuffer) = 0;
+
+    //!
+    //! \brief    Set Composite Prolog CMD
+    //! \param    [in] pRenderHal
+    //!           Pointer to Hardware Interface
+    //! \param    [in,out] pCmdBuffer
+    //!           Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS SetCompositePrologCmd(
+        PRENDERHAL_INTERFACE         pRenderHal,
+        PMOS_COMMAND_BUFFER          pCmdBuffer)
+    {
+        return MOS_STATUS_SUCCESS;
+    }
+
+    //!
+    //! \brief    Get Render Hal MMC Enable/Disable Flag
+    //! \param    [in] pRenderHal
+    //!           Pointer to Hardware Interface
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS IsRenderHalMMCEnabled(
+        PRENDERHAL_INTERFACE         pRenderHal)
+    {
+        MOS_UNUSED(pRenderHal);
+
+        return MOS_STATUS_SUCCESS;
+    }
+
+    //!
+    //! \brief    Check if Override is needed or not
+    //! \param    [in] pRenderHal
+    //!           Pointer to Hardware Interface
+    //! \param    [in,out] pCmdBuffer
+    //!           Pointer to Command Buffer
+    //! \param    [in] pGenericPrologParam
+    //!           Pointer to MHW generic prolog parameters
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS IsOvrdNeeded(
+        PRENDERHAL_INTERFACE              pRenderHal,
+        PMOS_COMMAND_BUFFER               pCmdBuffer,
+        PRENDERHAL_GENERIC_PROLOG_PARAMS  pGenericPrologParams) {return MOS_STATUS_SUCCESS;};
+
+    //!
+    //! \brief    Check if Chromasiting is enabled
+    //! \param    [in] pRenderHal
+    //!           Pointer to Hardware Interface
+    //! \param    [in] pParams
+    //!           Pointer to Surface State Params
+    //! \return   bool
+    //!           true or false
+    //!
+    virtual bool IsChromasitingEnabled(
+        PRENDERHAL_INTERFACE            pRenderHal,
+        PRENDERHAL_SURFACE_STATE_PARAMS pParams) {return false;};
+
+    //!
+    //! \brief    Get PlaneDefinition for Format_Y216
+    //! \param    [in] isRenderTarget
+    //!           The flag to indicate if the surface is rendertarget or not
+    //! \param    [in] pRenderHal
+    //!           Pointer to Hardware Interface
+    //! \param    [in,out] PlaneDefinition
+    //!           Pointer to PlaneDefinition
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS GetPlaneDefForFormatY216(
+        bool                       isRenderTarget,
+        PRENDERHAL_INTERFACE       pRenderHal,
+        RENDERHAL_PLANE_DEFINITION &PlaneDefinition)
+    {
+        PlaneDefinition = isRenderTarget ? RENDERHAL_PLANES_Y210_RT : (pRenderHal->bIsAVS ? RENDERHAL_PLANES_Y210_ADV : RENDERHAL_PLANES_Y210);
+        return MOS_STATUS_SUCCESS;
+    };
+
+    //!
+    //! \brief    Get PlaneDefinition for NV12
+    //! \param    [in,out] PlaneDefinition
+    //!           Pointer to PlaneDefinition
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS GetPlaneDefForFormatNV12(
+        RENDERHAL_PLANE_DEFINITION &PlaneDefinition)
+    {
+        PlaneDefinition = RENDERHAL_PLANES_NV12;
+        return MOS_STATUS_SUCCESS;
+    };
+
+    //! \brief      Set L3 cache override config parameters
+    //! \param      [in] pRenderHal
+    //!             Pointer to RenderHal Interface Structure
+    //! \param      [in,out] pCacheSettings
+    //!             Pointer to pCacheSettings
+    //! \param      [in] bEnableSLM
+    //!             Flag to enable SLM
+    //! \return     MOS_STATUS
+    //!             MOS_STATUS_SUCCESS if success. Error code otherwise
+    //!
+    virtual MOS_STATUS SetCacheOverrideParams(
+        PRENDERHAL_INTERFACE            pRenderHal,
+        PRENDERHAL_L3_CACHE_SETTINGS    pCacheSettings,
+        bool                            bEnableSLM) = 0;
+
+    //! \brief      Get the size of Render Surface State Command
+    //! \return     size_t
+    //!             the size of render surface state command
+    virtual size_t GetSurfaceStateCmdSize() = 0;
+
+    //! \brief      Get the address of the ith Palette Data
+    //! \param      [in] i
+    //!             Index of the palette data
+    //! \return     void *
+    //!             address of the ith palette data table
+    virtual void* GetPaletteDataAddress(int i) = 0;
+
+    //! \brief      Get the size of Binding Table State Command
+    //! \return     size_t
+    //!             the size of binding table state command
+    virtual size_t GetBTStateCmdSize() = 0;
+
+    //! \brief    Check if compute context in use
+    //! \param    PRENDERHAL_INTERFACE    pRenderHal
+    //!           [in]  Pointer to RenderHal Interface
+    //! \return   true or false
+    virtual bool IsComputeContextInUse(
+        PRENDERHAL_INTERFACE    pRenderHal) = 0;
+
+    //! \brief    Add Pipeline SelectCmd
+    //! \details  Add Pipeline SelectCmd
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    virtual MOS_STATUS AddPipelineSelectCmd(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer,
+        bool                        gpGpuPipe) = 0;
+
+    //! \brief    Send StateBase Address
+    //! \details  Send StateBase Address
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    virtual MOS_STATUS SendStateBaseAddress(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer) = 0;
+
+    //! \brief    Add Sip State Cmd
+    //! \details  Add Sip State Cmd
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    virtual MOS_STATUS AddSipStateCmd(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer) = 0;
+
+    //! \brief    Add Cfe State Cmd
+    //! \details  Add Cfe State Cmd
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    virtual MOS_STATUS AddCfeStateCmd(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer,
+        PMHW_VFE_PARAMS             params) = 0;
+
+    //! \brief    Send ChromaKey
+    //! \details  Send ChromaKey
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    virtual MOS_STATUS SendChromaKey(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer,
+        PMHW_CHROMAKEY_PARAMS       pChromaKeyParams) = 0;
+
+    //! \brief    Send Palette
+    //! \details  Send Palette
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    virtual MOS_STATUS SendPalette(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer,
+        PMHW_PALETTE_PARAMS         pPaletteLoadParams) = 0;
+
+    //! \brief    Set L3Cache
+    //! \details  Set L3Cache
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    virtual MOS_STATUS SetL3Cache(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer) = 0;
+
+    virtual PMHW_MI_MMIOREGISTERS GetMmioRegisters(
+        PRENDERHAL_INTERFACE        pRenderHal) = 0;
+
+    virtual MOS_STATUS EnablePreemption(
+        PRENDERHAL_INTERFACE            pRenderHal,
+        PMOS_COMMAND_BUFFER             pCmdBuffer) = 0;
+
+    virtual MOS_STATUS SendPredicationCommand(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer) = 0;
+
+    //! \brief    Adds marker attributes in command buffer
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    PMOS_COMMAND_BUFFER pcmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \param    bool isRender
+    //!           [in] Flag of Render Engine
+    //! \return   MOS_STATUS
+    virtual MOS_STATUS SendMarkerCommand(
+        PRENDERHAL_INTERFACE    pRenderHal,
+        PMOS_COMMAND_BUFFER     cmdBuffer,
+        bool                    isRender) = 0;
+
+    virtual MOS_STATUS AddMiPipeControl(
+        PRENDERHAL_INTERFACE    pRenderHal,
+        PMOS_COMMAND_BUFFER        pCmdBuffer,
+        MHW_PIPE_CONTROL_PARAMS*   params) = 0;
+
+    //!
+    //! \brief    Adds MI_LOAD_REGISTER_IMM to the command buffer
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    [in] pCmdBuffer
+    //!           Command buffer to which requested command is added
+    //! \param    [in] params
+    //!           Parameters used to populate the requested command
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS AddMiLoadRegisterImmCmd(
+        PRENDERHAL_INTERFACE             pRenderHal,
+        PMOS_COMMAND_BUFFER              pCmdBuffer,
+        PMHW_MI_LOAD_REGISTER_IMM_PARAMS params) = 0;
+
+    virtual MOS_STATUS SendGenericPrologCmd(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer,
+        PMHW_GENERIC_PROLOG_PARAMS  pParams,
+        MHW_MI_MMIOREGISTERS* pMmioReg = nullptr) = 0;
+
+    //! \brief    Send Compute Walker
+    //! \details  Send Compute Walker
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \param    PRENDERHAL_GPGPU_WALKER_PARAMS pGpGpuWalkerParams
+    //!           [in]    Pointer to GPGPU walker parameters
+    //! \return   MOS_STATUS
+    virtual MOS_STATUS SendComputeWalker(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer,
+        PMHW_GPGPU_WALKER_PARAMS    pGpGpuWalkerParams)
+    {
+        return MOS_STATUS_SUCCESS;
+    };
+
+    //! \brief    Send To 3DState Binding Table Pool Alloc
+    //! \details  Send To 3DState Binding Table Pool Alloc
+    //! \param    PRENDERHAL_INTERFACE pRenderHal
+    //!           [in] Pointer to RenderHal Interface Structure
+    //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
+    //!           [in] Pointer to Command Buffer
+    //! \return   MOS_STATUS
+    virtual MOS_STATUS SendTo3DStateBindingTablePoolAlloc(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer)
+    {
+        return MOS_STATUS_SUCCESS;
+    };
+
+    //! \brief    Allocates scratch space buffer.
+    //! \details  On some new pltforms, a single scratch space buffer may be allocated and used for
+    //!           all threads.
+    //! \return   Single scratch space buffer is supported on specific platforms, so
+    //!           MOS_STATUS_UNIMPLEMENTED is returned in base class implementation.
+    virtual MOS_STATUS AllocateScratchSpaceBuffer(
+        uint32_t perThreadScratchSpace,
+        RENDERHAL_INTERFACE *renderHal) { return MOS_STATUS_UNIMPLEMENTED; }
+
+    //! \brief    Frees scratch space buffer.
+    //! \details  On some new pltforms, a single scratch space buffer may be allocated and used for
+    //!           all threads.
+    //! \return   Single scratch space buffer is supported on specific platforms, so
+    //!           MOS_STATUS_UNIMPLEMENTED is returned in base class implementation.
+    virtual MOS_STATUS FreeScratchSpaceBuffer(
+        RENDERHAL_INTERFACE *renderHal) { return MOS_STATUS_UNIMPLEMENTED; }
+
+    //!
+    //! \brief      enable/disable the fusedEUDispatch flag in the VFE_PARAMS
+    //! \return     no return value
+    //!
+    virtual void SetFusedEUDispatch(bool enable)
+    {
+        MOS_UNUSED(enable);
+
+        return;
+    }
+
+    virtual MOS_STATUS CreateMhwInterfaces(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_INTERFACE              pOsInterface) = 0;
+
+    virtual MOS_STATUS On1stLevelBBStart(
+        PRENDERHAL_INTERFACE pRenderHal,
+        PMOS_COMMAND_BUFFER  pCmdBuffer,
+        PMOS_CONTEXT         pOsContext,
+        uint32_t             gpuContextHandle,
+        MHW_MI_MMIOREGISTERS *pMmioReg) = 0;
+
+    virtual MOS_STATUS OnDispatch(
+        PRENDERHAL_INTERFACE pRenderHal,
+        PMOS_COMMAND_BUFFER  pCmdBuffer,
+        PMOS_CONTEXT         pOsContext,
+        MHW_MI_MMIOREGISTERS *pMmioReg) = 0;
+
+    virtual MOS_STATUS CreatePerfProfiler(
+        PRENDERHAL_INTERFACE pRenderHal) = 0;
+
+    virtual MOS_STATUS DestroyPerfProfiler(
+        PRENDERHAL_INTERFACE pRenderHal) = 0;
+
+    virtual MOS_STATUS AddPerfCollectStartCmd(
+        PRENDERHAL_INTERFACE pRenderHal,
+        MOS_INTERFACE        *osInterface,
+        MOS_COMMAND_BUFFER   *cmdBuffer) = 0;
+
+    virtual MOS_STATUS StartPredicate(
+        PRENDERHAL_INTERFACE pRenderHal,
+        PMOS_COMMAND_BUFFER  cmdBuffer) = 0;
+
+    virtual MOS_STATUS StopPredicate(
+        PRENDERHAL_INTERFACE pRenderHal,
+        PMOS_COMMAND_BUFFER  cmdBuffer) = 0;
+
+    virtual MOS_STATUS AddPerfCollectEndCmd(
+        PRENDERHAL_INTERFACE pRenderHal,
+        PMOS_INTERFACE       pOsInterface,
+        MOS_COMMAND_BUFFER   *cmdBuffer) = 0;
+
+    virtual MOS_STATUS AddMediaVfeCmd(
+        PRENDERHAL_INTERFACE    pRenderHal,
+        PMOS_COMMAND_BUFFER     pCmdBuffer,
+        MHW_VFE_PARAMS          *params) = 0;
+
+    virtual MOS_STATUS AddMediaStateFlush(
+        PRENDERHAL_INTERFACE         pRenderHal,
+        PMOS_COMMAND_BUFFER          pCmdBuffer,
+        MHW_MEDIA_STATE_FLUSH_PARAM  *params) = 0;
+
+    virtual MOS_STATUS AddMiBatchBufferEnd(
+        PRENDERHAL_INTERFACE         pRenderHal,
+        PMOS_COMMAND_BUFFER          pCmdBuffer,
+        PMHW_BATCH_BUFFER            batchBuffer) = 0;
+
+    virtual MOS_STATUS AddMediaObjectWalkerCmd(
+        PRENDERHAL_INTERFACE         pRenderHal,
+        PMOS_COMMAND_BUFFER          pCmdBuffer,
+        PMHW_WALKER_PARAMS           params) = 0;
+
+    virtual MOS_STATUS AddGpGpuWalkerStateCmd(
+        PRENDERHAL_INTERFACE        pRenderHal,
+        PMOS_COMMAND_BUFFER         pCmdBuffer,
+        PMHW_GPGPU_WALKER_PARAMS    params) = 0;
+
+    virtual MOS_STATUS AllocateHeaps(
+        PRENDERHAL_INTERFACE     pRenderHal,
+        MHW_STATE_HEAP_SETTINGS  MhwStateHeapSettings) = 0;
+
+    virtual PMHW_STATE_HEAP_INTERFACE GetStateHeapInterface(
+        PRENDERHAL_INTERFACE     pRenderHal) = 0;
+
+    virtual MOS_STATUS DestoryMhwInterface(
+        PRENDERHAL_INTERFACE     pRenderHal) = 0;
+
+    virtual MOS_STATUS AddMediaCurbeLoadCmd(
+        PRENDERHAL_INTERFACE         pRenderHal,
+        PMOS_COMMAND_BUFFER          pCmdBuffer,
+        PMHW_CURBE_LOAD_PARAMS       params) = 0;
+
+    virtual MOS_STATUS AddMediaIDLoadCmd(
+        PRENDERHAL_INTERFACE         pRenderHal,
+        PMOS_COMMAND_BUFFER          pCmdBuffer,
+        PMHW_ID_LOAD_PARAMS          params) = 0;
+
+    virtual bool IsPreemptionEnabled(
+        PRENDERHAL_INTERFACE     pRenderHal) = 0;
+
+    virtual void GetSamplerResolutionAlignUnit(
+        PRENDERHAL_INTERFACE         pRenderHal,
+        bool                         isAVSSampler,
+        uint32_t                     &widthAlignUnit,
+        uint32_t                     &heightAlignUnit) = 0;
+
+    virtual PMHW_RENDER_ENGINE_CAPS GetHwCaps(
+        PRENDERHAL_INTERFACE         pRenderHal) = 0;
+
+    virtual std::shared_ptr<mhw::mi::Itf> GetMhwMiItf() = 0;
+
+};
+
+#endif // __RENDERHAL_PLATFORM_INTERFACE_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/shared/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/shared/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/shared/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/shared/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2021, Intel Corporation
+# Copyright (c) 2021-2022, Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -24,17 +24,15 @@ set(TMP_HEADERS_
     ${CMAKE_CURRENT_LIST_DIR}/null_hardware.h
 )
 
-set(HEADERS_
-    ${HEADERS_}
-    ${TMP_HEADERS_}
-)
 
-set(COMMON_HEADERS_
-    ${COMMON_HEADERS_}
+set(SOFTLET_COMMON_HEADERS_
+    ${SOFTLET_COMMON_HEADERS_}
     ${TMP_HEADERS_}
 )
 
 source_group( "Common Files" FILES ${TMP_SOURCES_} ${TMP_HEADERS_} )
 
-
-media_add_curr_to_include_path()
+set(SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_
+    ${SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/shared/user_setting/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/shared/user_setting/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/shared/user_setting/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/shared/user_setting/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2021, Intel Corporation
+# Copyright (c) 2021-2022, Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -26,16 +26,14 @@ set(TMP_HEADERS_
     ${CMAKE_CURRENT_LIST_DIR}/media_user_setting.h
 )
 
-set(HEADERS_
-    ${HEADERS_}
-    ${TMP_HEADERS_}
-)
 
-set(COMMON_HEADERS_
-    ${COMMON_HEADERS_}
+set(SOFTLET_COMMON_HEADERS_
+    ${SOFTLET_COMMON_HEADERS_}
     ${TMP_HEADERS_})
 
 source_group( "Common Files" FILES ${TMP_SOURCES_} ${TMP_HEADERS_} )
 
-
-media_add_curr_to_include_path()
+set(SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_
+    ${SOFTLET_COMMON_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_configure.h 22.5.1+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_configure.h
--- 22.4.3+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_configure.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_configure.h	2022-07-19 15:03:31.000000000 +0000
@@ -35,6 +35,12 @@ namespace MediaUserSetting {
 
 namespace Internal {
 
+typedef struct _ExtPathCFG
+{
+    const char *subPath;
+    bool        bStated;
+} ExtPathCFG;
+
 class Configure
 {
 public:
@@ -129,39 +135,22 @@ public:
         uint32_t option = MEDIA_USER_SETTING_INTERNAL);
 
     //!
-    //! \brief    Get the path of the key
+    //! \brief    Get the report path of the key
     //! \return   std::string
     //!           the path
     //!
-    std::string GetPath(
+    std::string GetReportPath(
         std::shared_ptr<Definition> def,
-        uint32_t                    option,
-        bool                        bReport);
-
-    //!
-    //! \brief    Get the report path of the internal key
-    //! \return   std::string
-    //!           the path
-    //!
-    std::string GetInteranlReportPath(
-        std::shared_ptr<Definition> def);
-
-    //!
-    //! \brief    Get the read path of the internal key
-    //! \return   std::string
-    //!           the path
-    //!
-    std::string GetInteranlReadPath(
-        std::shared_ptr<Definition> def);
+        uint32_t option);
 
     //!
-    //! \brief    Get the path of the internal key
+    //! \brief    Get the read path of the key
     //! \return   std::string
     //!           the path
     //!
-    std::string GetInternalPath(
+    std::string GetReadPath(
         std::shared_ptr<Definition> def,
-        bool                        bReport);
+        uint32_t option);
 
     //!
     //! \brief    Get the path of the external key
@@ -233,7 +222,9 @@ protected:
     static const UFKEY_NEXT m_rootKey;
     static const char *m_configPath;
     static const char *m_reportPath;
-    static const std::map<uint32_t, const char *> m_pathOption;
+    static const std::map<uint32_t, ExtPathCFG> m_pathOption;
+    std::string                                 m_statedConfigPath = "";
+    std::string                                 m_statedReportPath = "";
 };
 }
 }
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_definition.h 22.5.1+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_definition.h
--- 22.4.3+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_definition.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_definition.h	2022-07-19 15:03:31.000000000 +0000
@@ -30,6 +30,8 @@
 #include <string>
 #include <map>
 #include <memory>
+#include <iosfwd>
+#include "mos_defs_specific.h"
 #include "media_user_setting_value.h"
 
 namespace MediaUserSetting {
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting.h 22.5.1+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting.h
--- 22.4.3+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting.h	2022-07-19 15:03:31.000000000 +0000
@@ -44,7 +44,6 @@
 #ifndef __MEDIA_USER_SETTING__H__
 #define __MEDIA_USER_SETTING__H__
 
-#include <memory>
 #include <string>
 #include <map>
 #include "media_user_setting_configure.h"
@@ -180,8 +179,6 @@ protected:
 
 }
 
-using MediaUserSettingSharedPtr = std::shared_ptr<MediaUserSetting::MediaUserSetting>;
-
 inline MOS_STATUS DeclareUserSettingKey(
     MediaUserSettingSharedPtr userSetting,
     const std::string &valueName,
@@ -364,9 +361,9 @@ inline MOS_STATUS ReportUserSettingForDe
 
 #else
 #define DeclareUserSettingKeyForDebug(userSetting, valueName, group, defaultValue, isReportKey, ...) MOS_STATUS_SUCCESS
-#define ReadUserSettingForDebug(userSetting, value, valueName, group, customValue, useCustomValue) MOS_STATUS_SUCCESS
-#define WriteUserSettingForDebug(userSetting, valueName, value, group) MOS_STATUS_SUCCESS
-#define ReportUserSettingForDebug(userSetting, valueName, value, group) MOS_STATUS_SUCCESS
+#define ReadUserSettingForDebug(userSetting, value, valueName, group, ...) MOS_STATUS_SUCCESS
+#define WriteUserSettingForDebug(userSetting, valueName, value, group, ...) MOS_STATUS_SUCCESS
+#define ReportUserSettingForDebug(userSetting, valueName, value, group, ...) MOS_STATUS_SUCCESS
 #endif
 
 template <typename T, typename U = int>
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_value.h 22.5.1+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_value.h
--- 22.4.3+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_value.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/shared/user_setting/media_user_setting_value.h	2022-07-19 15:03:31.000000000 +0000
@@ -27,7 +27,7 @@
 #ifndef __MEDIA_USER_SETTING_VALUE_H__
 #define __MEDIA_USER_SETTING_VALUE_H__
 
-#include "mos_defs.h"
+#include "mos_utilities_common.h"
 #include <string>
 #include <sstream>
 
@@ -86,12 +86,15 @@ public:
     const std::string &ConstString() const { return m_value; }
 
     const std::size_t &Size() const { return m_size; }
+    const MOS_USER_FEATURE_VALUE_TYPE &ValueType() const { return m_type; }
+
 private:
     template <class T>
     std::string ToString(const T &data);
 private:
     std::size_t m_size = 0;
     std::string m_value{};
+    MOS_USER_FEATURE_VALUE_TYPE m_type = MOS_USER_FEATURE_VALUE_TYPE_INVALID;
 };
 }
 
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/vp/hal/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/vp/hal/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/vp/hal/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/vp/hal/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -21,14 +21,18 @@
 set(TMP_HEADERS_
     ${CMAKE_CURRENT_LIST_DIR}/vp_common.h
     ${CMAKE_CURRENT_LIST_DIR}/vp_common_hdr.h
+    ${CMAKE_CURRENT_LIST_DIR}/vp_common_tools.h
 )
 
-set(VP_HEADERS_
-    ${VP_HEADERS_}
+set(SOFTLET_VP_HEADERS_
+    ${SOFTLET_VP_HEADERS_}
     ${TMP_HEADERS_}
 )
 
 source_group( "VpHalNext" FILES ${TMP_HEADERS_} )
 set(TMP_HEADERS_ "")
 
-media_add_curr_to_include_path()
+set (SOFTLET_VP_PRIVATE_INCLUDE_DIRS_
+    ${SOFTLET_VP_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/vp/hal/vp_common.h 22.5.1+ds1-1/media_common/agnostic/common/vp/hal/vp_common.h
--- 22.4.3+ds1-1/media_common/agnostic/common/vp/hal/vp_common.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/vp/hal/vp_common.h	2022-07-19 15:03:31.000000000 +0000
@@ -123,6 +123,114 @@ extern "C" {
 #define VPHAL_TOP_FIELD_FIRST 0
 #define VPHAL_BOTTOM_FIELD_FIRST 1
 
+//*-----------------------------------------------------------------------------
+//| DEFINITIONS
+//*-----------------------------------------------------------------------------
+// Incremental size for allocating/reallocating resource
+#define VPHAL_BUFFER_SIZE_INCREMENT 128
+
+// VPP internal resource NotLockable flag macro
+#define VPP_INTER_RESOURCE_NOTLOCKABLE true
+#define VPP_INTER_RESOURCE_LOCKABLE false
+
+// Media Features width
+#define VPHAL_RNDR_8K_WIDTH (7680)
+#define VPHAL_RNDR_16K_HEIGHT_LIMIT (16352)
+
+// Media Features height
+#define VPHAL_RNDR_2K_HEIGHT 1080
+// The reason that the definition is not (VPHAL_RNDR_2K_HEIGHT*2) is because some 4K clips have 1200 height.
+#define VPHAL_RNDR_4K_HEIGHT 1200
+#define VPHAL_RNDR_4K_MAX_HEIGHT 3112
+#define VPHAL_RNDR_4K_MAX_WIDTH 4096
+#define VPHAL_RNDR_6K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 3)
+#define VPHAL_RNDR_8K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 4)
+#define VPHAL_RNDR_10K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 5)
+#define VPHAL_RNDR_12K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 6)
+#define VPHAL_RNDR_14K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 7)
+#define VPHAL_RNDR_16K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 8)
+#define VPHAL_RNDR_18K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 9)
+#define VPHAL_RNDR_20K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 10)
+#define VPHAL_RNDR_22K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 11)
+#define VPHAL_RNDR_24K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 12)
+#define VPHAL_RNDR_26K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 13)
+#define VPHAL_RNDR_28K_HEIGHT (VPHAL_RNDR_2K_HEIGHT * 14)
+
+//!
+//! \def MEDIA_IS_HDCONTENT(dwWidth, dwHeight)
+//! Determine if the size of content is HD
+//!
+#define MEDIA_SDCONTENT_MAX_WIDTH 720
+#define MEDIA_SDCONTENT_MAX_PAL_HEIGHT 576
+#define MEDIA_SDCONTENT_MAX_SW_WIDTH 768
+#define MEDIA_IS_HDCONTENT(dwWidth, dwHeight) ((dwWidth > MEDIA_SDCONTENT_MAX_SW_WIDTH) || (dwHeight > MEDIA_SDCONTENT_MAX_PAL_HEIGHT))
+
+//! \brief  Surface cache attributes
+//!
+#define VPHAL_SET_SURF_MEMOBJCTL(VpField, GmmUsageEnum)                                                                      \
+    {                                                                                                                        \
+        Usage      = GmmUsageEnum;                                                                                           \
+        MemObjCtrl = pOsInterface->pfnCachePolicyGetMemoryObject(Usage, pOsInterface->pfnGetGmmClientContext(pOsInterface)); \
+        VpField    = MemObjCtrl.DwordValue;                                                                                  \
+    }
+
+//!
+//! \def WITHIN_BOUNDS(a, min, max)
+//! Calcualte if \a a within the range of  [\a min, \a max].
+//!
+#define WITHIN_BOUNDS(a, min, max) (((a) >= (min)) && ((a) <= (max)))
+
+//!
+//! \def SAME_SIZE_RECT(rect1, rect2)
+//! Compare if the size of two rectangles is the same
+//!
+#define SAME_SIZE_RECT(rect1, rect2)                                   \
+    (((rect1).right - (rect1).left == (rect2).right - (rect2).left) && \
+        ((rect1).bottom - (rect1).top == (rect2).bottom - (rect2).top))
+
+//!
+//! \def IS_YUV_FULL_RANGE(_a)
+//! Check if YUV full range
+//!
+#define IS_YUV_FULL_RANGE(_a) (_a == CSpace_BT601_FullRange ||     \
+                               _a == CSpace_BT709_FullRange ||     \
+                               _a == CSpace_BT601Gray_FullRange || \
+                               _a == CSpace_BT2020_FullRange)
+
+//!
+//! \brief Base VP kernel list
+//!
+enum VpKernelID
+{
+    // FC
+    kernelCombinedFc = 0,
+
+    // 2 VEBOX KERNELS
+    kernelVeboxSecureBlockCopy,
+    kernelVeboxUpdateDnState,
+
+    // User Ptr
+    kernelUserPtr,
+    // Fast 1toN
+    kernelFast1toN,
+
+    // HDR
+    kernelHdrMandatory,
+    kernelHdrPreprocess,
+
+    // mediacopy-render copy
+    kernelRenderCopy,
+
+    baseKernelMaxNumID
+};
+
+enum VpKernelIDNext
+{
+    vpKernelIDNextBase = 0x200,
+    kernelHdr3DLutCalc = vpKernelIDNextBase,
+    kernelHVSCalc,
+    vpKernelIDNextMax
+};
 
 
 typedef struct _VPHAL_COMPOSITE_CACHE_CNTL
@@ -133,6 +241,29 @@ typedef struct _VPHAL_COMPOSITE_CACHE_CN
     VPHAL_MEMORY_OBJECT_CONTROL TargetSurfMemObjCtl;
 } VPHAL_COMPOSITE_CACHE_CNTL, *PVPHAL_COMPOSITE_CACHE_CNTL;
 
+//!
+//! \brief Vphal Output chroma configuration enum
+//!
+typedef enum _VPHAL_CHROMA_SUBSAMPLING
+{
+    CHROMA_SUBSAMPLING_TOP_CENTER = 0,
+    CHROMA_SUBSAMPLING_CENTER_CENTER,
+    CHROMA_SUBSAMPLING_BOTTOM_CENTER,
+    CHROMA_SUBSAMPLING_TOP_LEFT,
+    CHROMA_SUBSAMPLING_CENTER_LEFT,
+    CHROMA_SUBSAMPLING_BOTTOM_LEFT
+} VPHAL_CHROMA_SUBSAMPLING;
+
+//!
+//! \brief Vphal Gamma Values configuration enum
+//!
+typedef enum _VPHAL_GAMMA_VALUE
+{
+    GAMMA_1P0 = 0,
+    GAMMA_2P2,
+    GAMMA_2P6
+} VPHAL_GAMMA_VALUE;
+
 typedef struct _VPHAL_DNDI_CACHE_CNTL
 {
     bool                        bL3CachingEnabled;
@@ -581,8 +712,8 @@ typedef struct _VPHAL_PALETTE
 //!
 typedef struct _VPHAL_BLENDING_PARAMS
 {
-    VPHAL_BLEND_TYPE BlendType;
-    float            fAlpha;
+    VPHAL_BLEND_TYPE BlendType = BLEND_NONE;
+    float            fAlpha    = 0.0;
 } VPHAL_BLENDING_PARAMS, *PVPHAL_BLENDING_PARAMS;
 
 //!
@@ -591,8 +722,8 @@ typedef struct _VPHAL_BLENDING_PARAMS
 //!
 typedef struct _VPHAL_LUMAKEY_PARAMS
 {
-    int16_t LumaLow;
-    int16_t LumaHigh;
+    int16_t LumaLow  = 0;
+    int16_t LumaHigh = 0;
 } VPHAL_LUMAKEY_PARAMS, *PVPHAL_LUMAKEY_PARAMS;
 
 //!
@@ -601,11 +732,11 @@ typedef struct _VPHAL_LUMAKEY_PARAMS
 //!
 typedef struct _VPHAL_PROCAMP_PARAMS
 {
-    bool  bEnabled;
-    float fBrightness;
-    float fContrast;
-    float fHue;
-    float fSaturation;
+    bool  bEnabled    = false;
+    float fBrightness = 0.0;
+    float fContrast   = 0.0;
+    float fHue        = 0.0;
+    float fSaturation = 0.0;
 } VPHAL_PROCAMP_PARAMS, *PVPHAL_PROCAMP_PARAMS;
 
 //!
@@ -614,15 +745,15 @@ typedef struct _VPHAL_PROCAMP_PARAMS
 //!
 typedef struct _VPHAL_IEF_PARAMS
 {
-    bool     bEnabled;
-    bool     bSmoothMode;
-    bool     bSkintoneTuned;
-    bool     bEmphasizeSkinDetail;
-    float    fIEFFactor;
-    uint16_t StrongEdgeWeight;
-    uint16_t RegularWeight;
-    uint16_t StrongEdgeThreshold;
-    void *   pExtParam;
+    bool     bEnabled             = false;
+    bool     bSmoothMode          = false;
+    bool     bSkintoneTuned       = false;
+    bool     bEmphasizeSkinDetail = false;
+    float    fIEFFactor           = 0.0;
+    uint16_t StrongEdgeWeight     = 0;
+    uint16_t RegularWeight        = 0;
+    uint16_t StrongEdgeThreshold  = 0;
+    void *   pExtParam            = nullptr;
 } VPHAL_IEF_PARAMS, *PVPHAL_IEF_PARAMS;
 
 //!
@@ -631,10 +762,10 @@ typedef struct _VPHAL_IEF_PARAMS
 //!
 typedef struct _VPHAL_DI_PARAMS
 {
-    VPHAL_DI_MODE DIMode;        //!< DeInterlacing mode
-    bool          bEnableFMD;    //!< FMD
-    bool          bSingleField;  //!< Used in frame Recon - if 30fps (one call per sample pair)
-    bool          bSCDEnable;    //!< Scene change detection
+    VPHAL_DI_MODE DIMode       = DI_MODE_BOB;        //!< DeInterlacing mode
+    bool          bEnableFMD   = false;              //!< FMD
+    bool          bSingleField = false;              //!< Used in frame Recon - if 30fps (one call per sample pair)
+    bool          bSCDEnable   = false;              //!< Scene change detection
 } VPHAL_DI_PARAMS, *PVPHAL_DI_PARAMS;
 
 //!
@@ -715,7 +846,7 @@ typedef struct _VPHAL_DENOISE_PARAMS
 //!
 typedef struct _VPHAL_STE_PARAMS
 {
-    uint32_t dwSTEFactor;
+    uint32_t dwSTEFactor = 0;
 } VPHAL_STE_PARAMS, *PVPHAL_STE_PARAMS;
 
 //!
@@ -724,12 +855,12 @@ typedef struct _VPHAL_STE_PARAMS
 //!
 typedef struct _VPHAL_TCC_PARAMS
 {
-    uint8_t Red;
-    uint8_t Green;
-    uint8_t Blue;
-    uint8_t Cyan;
-    uint8_t Magenta;
-    uint8_t Yellow;
+    uint8_t Red     = 0;
+    uint8_t Green   = 0;
+    uint8_t Blue    = 0;
+    uint8_t Cyan    = 0;
+    uint8_t Magenta = 0;
+    uint8_t Yellow  = 0;
 } VPHAL_TCC_PARAMS, *PVPHAL_TCC_PARAMS;
 
 //!
@@ -738,14 +869,14 @@ typedef struct _VPHAL_TCC_PARAMS
 //!
 typedef struct _VPHAL_COLORPIPE_PARAMS
 {
-    bool             bEnableACE;
-    bool             bEnableSTE;
-    bool             bEnableTCC;
-    bool             bAceLevelChanged;
-    uint32_t         dwAceLevel;
-    uint32_t         dwAceStrength;
-    VPHAL_STE_PARAMS SteParams;
-    VPHAL_TCC_PARAMS TccParams;
+    bool             bEnableACE       = false;
+    bool             bEnableSTE       = false;
+    bool             bEnableTCC       = false;
+    bool             bAceLevelChanged = false;
+    uint32_t         dwAceLevel       = 0;
+    uint32_t         dwAceStrength    = 0;
+    VPHAL_STE_PARAMS SteParams        = {};
+    VPHAL_TCC_PARAMS TccParams        = {};
 } VPHAL_COLORPIPE_PARAMS, *PVPHAL_COLORPIPE_PARAMS;
 
 //!
@@ -754,14 +885,30 @@ typedef struct _VPHAL_COLORPIPE_PARAMS
 //!
 typedef struct _VPHAL_3DLUT_PARAMS
 {
-    PVPHAL_SURFACE pExt3DLutSurface;    // Pointer to the 3DLUT surface which app passes to driver.
-    uint32_t       LutSize;             // Size of 3DLUT, i.e, how many entries LUT has.
-    uint32_t       ChannelMapping;      // Channel Mapping for the 3DLUT input to 3DLUT output.
-    uint16_t       BitDepthPerChannel;  // Bit Depth Per Channel(4 channels for 3DLUT).
-    uint16_t       ByteCountPerEntry;   // Byte Count Per Entry including reserved bytes.
+    PVPHAL_SURFACE pExt3DLutSurface   = nullptr;   // Pointer to the 3DLUT surface which app passes to driver.
+    uint32_t       LutSize            = 0;    // Size of 3DLUT, i.e, how many entries LUT has.
+    uint32_t       ChannelMapping     = 0;    // Channel Mapping for the 3DLUT input to 3DLUT output.
+    uint16_t       BitDepthPerChannel = 0;    // Bit Depth Per Channel(4 channels for 3DLUT).
+    uint16_t       ByteCountPerEntry  = 0;    // Byte Count Per Entry including reserved bytes.
 } VPHAL_3DLUT_PARAMS, *PVPHAL_3DLUT_PARAMS;
 
 //!
+//! Structure VPHAL_GAMUT_PARAMS
+//! \brief IECP Gamut Mapping Parameters
+//!
+typedef struct _VPHAL_GAMUT_PARAMS
+{
+    VPHAL_GAMUT_MODE  GCompMode;
+    VPHAL_GAMUT_MODE  GExpMode;
+    VPHAL_GAMMA_VALUE GammaValue;
+    uint32_t          dwAttenuation;  //!< U2.10 [0, 1024] 0 = No down scaling, 1024 = Full down scaling
+    float             displayRGBW_x[4];
+    float             displayRGBW_y[4];
+    bool              bColorBalance;
+    int32_t           colorBalanceMatrix[3][3];
+} VPHAL_GAMUT_PARAMS, *PVPHAL_GAMUT_PARAMS;
+
+//!
 //! Structure VPHAL_SURFACE
 //! \brief DDI-VPHAL surface definition
 //!
@@ -885,11 +1032,11 @@ typedef struct _VPHAL_NLAS_PARAMS
 //!
 typedef struct _VPHAL_COLORFILL_PARAMS
 {
-    bool         bYCbCr;
-    uint32_t     Color;
-    VPHAL_CSPACE CSpace;
-    bool         bDisableColorfillinSFC;
-    bool         bOnePixelBiasinSFC;
+    bool         bYCbCr                 = false;
+    uint32_t     Color                  = 0;
+    VPHAL_CSPACE CSpace                 = CSpace_None;
+    bool         bDisableColorfillinSFC = false;
+    bool         bOnePixelBiasinSFC     = false;
 } VPHAL_COLORFILL_PARAMS, *PVPHAL_COLORFILL_PARAMS;
 
 //!
@@ -957,37 +1104,37 @@ typedef struct _VPHAL_SPLIT_SCREEN_DEMO_
 struct VPHAL_RENDER_PARAMS
 {
     // Input/output surfaces
-    uint32_t       uSrcCount;                   //!< Num sources
-    VPHAL_SURFACE *pSrc[VPHAL_MAX_SOURCES];     //!< Source Samples
-    uint32_t       uDstCount;                   //!< Num Targets
-    VPHAL_SURFACE *pTarget[VPHAL_MAX_TARGETS];  //!< Render Target
+    uint32_t       uSrcCount                   = 0;   //!< Num sources
+    VPHAL_SURFACE  *pSrc[VPHAL_MAX_SOURCES]    = {};  //!< Source Samples
+    uint32_t       uDstCount                   = 0;   //!< Num Targets
+    VPHAL_SURFACE  *pTarget[VPHAL_MAX_TARGETS] = {};  //!< Render Target
 
     // Additional parameters not included in PVPHAL_SURFACE
-    PRECT                                pConstriction;               //!< Constriction rectangle
-    PVPHAL_COLORFILL_PARAMS              pColorFillParams;            //!< ColorFill - BG only
-    bool                                 bTurboMode;                  //!< Enable Media Turbo Mode
-    bool                                 bStereoMode;                 //!< Stereo BLT mode
-    PVPHAL_ALPHA_PARAMS                  pCompAlpha;                  //!< Alpha for composited surfaces
-    bool                                 bDisableDemoMode;            //!< Enable/Disable demo mode function calls
-    PVPHAL_SPLIT_SCREEN_DEMO_MODE_PARAMS pSplitScreenDemoModeParams;  //!< Split-screen demo mode for VP features
-    bool                                 bIsDefaultStream;            //!< Identifier to differentiate default stream
+    PRECT                                pConstriction              = nullptr;  //!< Constriction rectangle
+    PVPHAL_COLORFILL_PARAMS              pColorFillParams           = nullptr;  //!< ColorFill - BG only
+    bool                                 bTurboMode                 = false;    //!< Enable Media Turbo Mode
+    bool                                 bStereoMode                = false;    //!< Stereo BLT mode
+    PVPHAL_ALPHA_PARAMS                  pCompAlpha                 = nullptr;  //!< Alpha for composited surfaces
+    bool                                 bDisableDemoMode           = false;    //!< Enable/Disable demo mode function calls
+    PVPHAL_SPLIT_SCREEN_DEMO_MODE_PARAMS pSplitScreenDemoModeParams = nullptr;  //!< Split-screen demo mode for VP features
+    bool                                 bIsDefaultStream           = false;    //!< Identifier to differentiate default stream
 
     // Debugging parameters
-    MOS_COMPONENT Component;  //!< DDI component (for DEBUGGING only)
+    MOS_COMPONENT Component = COMPONENT_UNKNOWN;  //!< DDI component (for DEBUGGING only)
 
     // Status Report
-    bool     bReportStatus;     //!< Report current media BB status (Pre-Processing)
-    uint32_t StatusFeedBackID;  //!< Unique Staus ID;
+    bool     bReportStatus    = false; //!< Report current media BB status (Pre-Processing)
+    uint32_t StatusFeedBackID = 0;     //!< Unique Staus ID;
 #if (_DEBUG || _RELEASE_INTERNAL)
-    bool bTriggerGPUHang;  //!< Trigger GPU HANG
+    bool bTriggerGPUHang = false;  //!< Trigger GPU HANG
 #endif
 
-    bool bCalculatingAlpha;  //!< Alpha calculation parameters
+    bool bCalculatingAlpha  = false;  //!< Alpha calculation parameters
 
     // extension parameters
-    void *pExtensionData;  //!< Extension data
+    void *pExtensionData    = nullptr;  //!< Extension data
 
-    bool bPathKernel;                 // HDR path config if use kernel
+    bool bPathKernel        = false;  // HDR path config if use kernel
     bool bAPGWorkloadEnable = false;  //!< Identify Whether APG workload Enabled or not
 
     bool bDisableVeboxFor8K = false;
@@ -1140,6 +1287,40 @@ MOS_STATUS VpHal_GetSurfaceInfo(
     PVPHAL_GET_SURFACE_INFO pInfo,
     PVPHAL_SURFACE          pSurface);
 
+//!
+//! \brief
+//! \details  Get CSC matrix in a form usable by Vebox, SFC and IECP kernels
+//! \param    [in] SrcCspace
+//!           Source Cspace
+//! \param    [in] DstCspace
+//!           Destination Cspace
+//! \param    [out] pfCscCoeff
+//!           [3x3] Coefficients matrix
+//! \param    [out] pfCscInOffset
+//!           [3x1] Input Offset matrix
+//! \param    [out] pfCscOutOffset
+//!           [3x1] Output Offset matrix
+//! \return   void
+//!
+void VpHal_GetCscMatrix(
+    VPHAL_CSPACE SrcCspace,
+    VPHAL_CSPACE DstCspace,
+    float *      pfCscCoeff,
+    float *      pfCscInOffset,
+    float *      pfCscOutOffset);
+
+//!
+//! \brief    Get the color pack type of a surface
+//! \details  Map mos surface format to color pack format and return.
+//!           For unknown format return VPHAL_COLORPACK_UNKNOWN
+//! \param    [in] Format
+//!           MOS_FORMAT of a surface
+//! \return   VPHAL_COLORPACK
+//!           Color pack type of the surface
+//!
+VPHAL_COLORPACK VpHal_GetSurfaceColorPack(
+    MOS_FORMAT Format);
+
 #ifdef __cplusplus
 }
 #endif
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/vp/hal/vp_common_hdr.h 22.5.1+ds1-1/media_common/agnostic/common/vp/hal/vp_common_hdr.h
--- 22.4.3+ds1-1/media_common/agnostic/common/vp/hal/vp_common_hdr.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/vp/hal/vp_common_hdr.h	2022-07-19 15:03:31.000000000 +0000
@@ -97,17 +97,17 @@ typedef enum _VPHAL_HDR_EOTF_TYPE
 //!
 typedef struct _VPHAL_HDR_PARAMS
 {
-    VPHAL_HDR_EOTF_TYPE EOTF;                 //!< Electronic-Optimal Transfer Function
-    uint16_t display_primaries_x[3];          //!< Display Primaries X chromaticity coordinates
-    uint16_t display_primaries_y[3];          //!< Display Primaries Y chromaticity coordinates
-    uint16_t white_point_x;                   //!< X Chromaticity coordinate of White Point
-    uint16_t white_point_y;                   //!< Y Chromaticity coordinate of White Point
-    uint16_t max_display_mastering_luminance; //!< The nominal maximum display luminance of the mastering display
-    uint16_t min_display_mastering_luminance; //!< The nominal minimum display luminance of the mastering display
-    uint16_t MaxCLL;                          //!< Max Content Light Level
-    uint16_t MaxFALL;                         //!< Max Frame Average Light Level
-    bool     bAutoMode;                       //!< Hdr auto mode.
-    bool     bPathKernel;                     //!< Hdr path config to use kernel
+    VPHAL_HDR_EOTF_TYPE EOTF                 = VPHAL_HDR_EOTF_INVALID;    //!< Electronic-Optimal Transfer Function
+    uint16_t display_primaries_x[3]          = {0};                       //!< Display Primaries X chromaticity coordinates
+    uint16_t display_primaries_y[3]          = {0};                       //!< Display Primaries Y chromaticity coordinates
+    uint16_t white_point_x                   = 0;                         //!< X Chromaticity coordinate of White Point
+    uint16_t white_point_y                   = 0;                         //!< Y Chromaticity coordinate of White Point
+    uint16_t max_display_mastering_luminance = 0;                         //!< The nominal maximum display luminance of the mastering display
+    uint16_t min_display_mastering_luminance = 0;                         //!< The nominal minimum display luminance of the mastering display
+    uint16_t MaxCLL                          = 0;                         //!< Max Content Light Level
+    uint16_t MaxFALL                         = 0;                         //!< Max Frame Average Light Level
+    bool     bAutoMode                       = false;                     //!< Hdr auto mode.
+    bool     bPathKernel                     = false;                     //!< Hdr path config to use kernel
 } VPHAL_HDR_PARAMS, *PVPHAL_HDR_PARAMS;
 
 #endif  // __VP_COMMON_HDR_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/vp/hal/vp_common_tools.h 22.5.1+ds1-1/media_common/agnostic/common/vp/hal/vp_common_tools.h
--- 22.4.3+ds1-1/media_common/agnostic/common/vp/hal/vp_common_tools.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/vp/hal/vp_common_tools.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,220 @@
+/*
+* Copyright (c) 2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     vp_common_tools.h
+//! \brief    vphal tools interface clarification
+//! \details  vphal tools interface clarification inlcuding:
+//!           some marcro, enum, structure, function
+//!
+#ifndef __VP_COMMON_TOOLS_H__
+#define __VP_COMMON_TOOLS_H__
+
+// max size of status table, this value must be power of 2 such as 256, 512, 1024, etc.
+// so VPHAL_STATUS_TABLE_MAX_SIZE-1 can form a one-filled mask to wind back a VPHAL_STATUS_TABLE ring table.
+#define VPHAL_STATUS_TABLE_MAX_SIZE    512
+
+//!
+//! Structure VPHAL_STATUS_ENTRY
+//! \brief Pre-Processing - Query status struct
+//!
+typedef struct _VPHAL_STATUS_ENTRY
+{
+    uint32_t        StatusFeedBackID;
+    MOS_GPU_CONTEXT GpuContextOrdinal;
+    uint32_t        dwTag;          // software tag, updated by driver for every command submit.
+    uint32_t        dwStatus;       // 0:OK; 1:Not Ready; 2:Not Available; 3:Error;
+    uint16_t        streamIndex;    // stream index corresponding to the gpucontext
+    bool            isStreamIndexSet;
+ } VPHAL_STATUS_ENTRY, *PVPHAL_STATUS_ENTRY;
+
+//!
+//! \brief Structure to VPHAL Status table
+//!
+typedef struct _VPHAL_STATUS_TABLE
+{
+    VPHAL_STATUS_ENTRY  aTableEntries[VPHAL_STATUS_TABLE_MAX_SIZE];
+    uint32_t            uiHead;
+    uint32_t            uiCurrent;
+} VPHAL_STATUS_TABLE, *PVPHAL_STATUS_TABLE;
+
+//!
+//! Structure STATUS_TABLE_UPDATE_PARAMS
+//! \brief Pre-Processing - params for updating status report table
+//!
+typedef struct _STATUS_TABLE_UPDATE_PARAMS
+{
+    bool                bReportStatus;
+    bool                bSurfIsRenderTarget;
+    PVPHAL_STATUS_TABLE pStatusTable;
+    uint32_t            StatusFeedBackID;
+#if (_DEBUG || _RELEASE_INTERNAL)
+    bool                bTriggerGPUHang;
+#endif
+    bool                bUpdateStreamIndex;
+ } STATUS_TABLE_UPDATE_PARAMS, *PSTATUS_TABLE_UPDATE_PARAMS;
+
+//!
+//! \brief Structure to query status params from application
+//! be noted that the structure is defined by app (msdk) so we cannot reorder its entries or size
+//!
+typedef struct _QUERY_STATUS_REPORT_APP
+{
+    uint32_t StatusFeedBackID;
+    uint32_t dwStatus          : 8;  //!< 0: OK; 1: Not Ready; 2: Not Available; 3: Error;
+    uint32_t                   : 24; //!< Reserved
+    uint32_t dwReserved[4];          //!< keep this to align what application (msdk lib) defined
+} QUERY_STATUS_REPORT_APP, *PQUERY_STATUS_REPORT_APP;
+
+//!
+//! \brief VPreP status
+//!
+typedef enum _VPREP_STATUS
+{
+    VPREP_OK           = 0,
+    VPREP_NOTREADY     = 1,
+    VPREP_NOTAVAILABLE = 2,
+    VPREP_ERROR        = 3
+} VPREP_STATUS;
+
+//!
+//! \brief Internal Override/Reporting Video Processing Configuration Values
+//!
+typedef struct _VP_CONFIG
+{
+    bool       bVpComponentReported;       // Vp Component has been reported
+    uint32_t   dwVpPath;                   // Video Processing path
+    uint32_t   dwVpComponent;              // Video Processing Component
+    uint32_t   dwCreatedDeinterlaceMode;   // Created Deinterlace mode
+    uint32_t   dwCurrentDeinterlaceMode;   // Current Deinterlace mode
+    uint32_t   dwReportedDeinterlaceMode;  // Reported Deinterlace mode
+    uint32_t   dwCreatedScalingMode;       // Created Scaling mode
+    uint32_t   dwCurrentScalingMode;       // Current Scaling mode
+    uint32_t   dwReportedScalingMode;      // Reported Scaling mode
+    uint32_t   dwReportedFastCopyMode;     // Reported FastCopy mode
+    uint32_t   dwCurrentXVYCCState;        // Current xvYCC State
+    uint32_t   dwReportedXVYCCState;       // Reported xvYCC state
+    uint32_t   dwCurrentOutputPipeMode;    // Current Output Pipe Mode
+    uint32_t   dwReportedOutputPipeMode;   // Reported Ouput Pipe Mode
+    uint32_t   dwCurrentVEFeatureInUse;    // Current VEFeatureInUse
+    uint32_t   dwReportedVEFeatureInUse;   // Reported VEFeatureInUse
+    uint32_t   dwCurrentFrcMode;           // Current Frame Rate Conversion Mode
+    uint32_t   dwReportedFrcMode;          // Reported Frame Rate Conversion Mode
+    uint32_t   dwVPMMCInUse;               // Memory compression enable flag
+    uint32_t   dwVPMMCInUseReported;       // Reported Memory compression enable flag
+    uint32_t   dwRTCompressible;           // RT MMC Compressible flag
+    uint32_t   dwRTCompressibleReported;   // RT MMC Reported compressible flag
+    uint32_t   dwRTCompressMode;           // RT MMC Compression Mode
+    uint32_t   dwRTCompressModeReported;   // RT MMC Reported Compression Mode
+    uint32_t   dwFFDICompressible;         // FFDI Compressible flag
+    uint32_t   dwFFDICompressMode;         // FFDI Compression mode
+    uint32_t   dwFFDNCompressible;         // FFDN Compressible flag
+    uint32_t   dwFFDNCompressMode;         // FFDN Compression mode
+    uint32_t   dwSTMMCompressible;         // STMM Compressible flag
+    uint32_t   dwSTMMCompressMode;         // STMM Compression mode
+    uint32_t   dwScalerCompressible;       // Scaler Compressible flag for Gen10
+    uint32_t   dwScalerCompressMode;       // Scaler Compression mode for Gen10
+    uint32_t   dwPrimaryCompressible;      // Input Primary Surface Compressible flag
+    uint32_t   dwPrimaryCompressMode;      // Input Primary Surface Compression mode
+    uint32_t   dwFFDICompressibleReported; // FFDI Reported Compressible flag
+    uint32_t   dwFFDICompressModeReported; // FFDI Reported Compression mode
+    uint32_t   dwFFDNCompressibleReported; // FFDN Reported Compressible flag
+    uint32_t   dwFFDNCompressModeReported; // FFDN Reported Compression mode
+    uint32_t   dwSTMMCompressibleReported; // STMM Reported Compressible flag
+    uint32_t   dwSTMMCompressModeReported; // STMM Reported Compression mode
+    uint32_t   dwScalerCompressibleReported;   // Scaler Reported Compressible flag for Gen10
+    uint32_t   dwScalerCompressModeReported;   // Scaler Reported Compression mode for Gen10
+    uint32_t   dwPrimaryCompressibleReported;  // Input Primary Surface Reported Compressible flag
+    uint32_t   dwPrimaryCompressModeReported;  // Input Primary Surface Reported Compression mode
+    uint32_t   dwCapturePipeInUse;         // Capture pipe
+    uint32_t   dwCapturePipeInUseReported; // Reported Capture pipe
+    uint32_t   dwCurrentCompositionMode;   // In Place or Legacy Composition
+    uint32_t   dwReportedCompositionMode;  // Reported Composition Mode
+    uint32_t   dwCurrentHdrMode;           // Current Hdr Mode
+    uint32_t   dwReportedHdrMode;          // Reported Hdr Mode
+    uint32_t   dwCurrentScdMode;           // Current Scd Mode
+    uint32_t   dwReportedScdMode;          // Reported Scd Mode
+    uint32_t   dwTCCPreprocessInUse;                // Vebox TCC Pre-process for HDR
+    uint32_t   dwTCCPreprocessInUseReported;        // Reported Vebox TCC Pre-process for HDR
+    uint32_t   dwIEFPreprocessInUse;                // Vebox IEF Pre-process for HDR
+    uint32_t   dwIEFPreprocessInUseReported;        // Reported Vebox IEF Pre-process for HDR
+    bool       bAdvancedScalingInUse;              // Advanced Scaling Enabled
+    bool       bAdvancedScalingInUseReported;      // Reported Advanced Scaling Enabled
+
+    // Configurations for cache control
+    uint32_t   dwDndiReferenceBuffer;
+    uint32_t   dwDndiOutputBuffer;
+    uint32_t   dwIecpOutputBuffer;
+    uint32_t   dwDnOutputBuffer;
+    uint32_t   dwStmmBuffer;
+    uint32_t   dwPhase2RenderTarget;
+    uint32_t   dwPhase2Source;
+    uint32_t   dwPhase1Source;
+
+    // For Deinterlace Mode - the flags reflect the content size and SKU,
+    // should not be changed after initialized.
+    bool       bFFDI;
+
+    //Debug enhancement to force color fill
+    //FALSE(0): no force color fill, TRUE(1): force color fill with default color,
+    //ELSE(other non-zero value): force color fill with color info from dwForceColorFill
+    uint32_t   dwForceColorFill;
+
+    //VEBOX perf is not enough for 8K@60fps processing
+    //add config to switch 8K resolution on VEBOX or render
+    //default is use render for 8k
+    uint32_t   dwUseVeboxFor8K;
+
+    // Optimize Cpu timing for VEBOX/SFC
+    bool       bOptimizeCpuTiming;
+} VP_CONFIG, *PVP_CONFIG;
+
+//!
+//! \brief status query param
+//!
+typedef struct _VPHAL_STATUS_PARAM
+{
+    uint32_t            FrameId;
+    VPREP_STATUS        BltStatus;
+} VPHAL_STATUS_PARAM, *PVPHAL_STATUS_PARAM;
+
+//!
+//! Structure VPHAL_QUERYVARIANCE_PARAMS
+//! \brief Query Variance Parameters
+//!
+typedef struct _VPHAL_QUERYVARIANCE_PARAMS
+{
+    uint32_t            dwFrameNumber;
+    void*               pVariances;
+} VPHAL_QUERYVARIANCE_PARAMS, *PVPHAL_QUERYVARIANCE_PARAMS;
+
+//!
+//! \brief Query Multiple Variance Parameters
+//!
+typedef struct _VPHAL_BATCHQUERYVARIANCE_PARAMS
+{
+    uint32_t            FrameCount;
+    uint32_t            BufferSize;
+    void                *pBuffer;
+} VPHAL_BATCHQUERYVARIANCE_PARAMS, *PVPHAL_BATCHQUERYVARIANCE_PARAMS;
+
+
+#endif  // __VP_COMMON_TOOLS_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/vp/kdll/hal_kerneldll_next.h 22.5.1+ds1-1/media_common/agnostic/common/vp/kdll/hal_kerneldll_next.h
--- 22.4.3+ds1-1/media_common/agnostic/common/vp/kdll/hal_kerneldll_next.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/vp/kdll/hal_kerneldll_next.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,905 @@
+/*
+* Copyright (c) 2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file      hal_kerneldll_next.h
+//! \brief         Fast Compositing dynamic kernel linking/loading definitions
+//!
+#ifndef __HAL_KERNELDLL_NEXT_H__
+#define __HAL_KERNELDLL_NEXT_H__
+
+#include "vp_common.h"
+// Kernel IDs and Kernel Names
+#include "vpkrnheader.h"  // IDR_VP_TOTAL_NUM_KERNELS
+#include "cm_fc_ld.h"
+
+#if EMUL
+
+#include "support.h"
+
+// Search callback codes
+#define CB_REASON_SEARCH_FAILED -1
+#define CB_REASON_UPDATE_FAILED -2
+#define CB_REASON_BEGIN_SEARCH 0
+#define CB_REASON_BEGIN_UPDATE 1
+#define CB_REASON_END_SEARCH 2
+
+#else  // EMUL
+
+#endif  // EMUL
+
+#define ROUND_FLOAT(n, factor) ((n) * (factor) + (((n) > 0.0f) ? 0.5f : -0.5f))
+
+#define MIN_SHORT -32768.0f
+#define MAX_SHORT 32767.0f
+#define FLOAT_TO_SHORT(n) (short)(MOS_MIN(MOS_MAX(MIN_SHORT, n), MAX_SHORT))
+
+#define DL_MAX_SEARCH_FILTER_SIZE 10  // max number of entries to describe a compositing filter
+
+#define DL_MAX_KERNELS 150         // Max component kernels to combine
+#define DL_MAX_PATCH_DATA_SIZE 64  // Max size of a patch block
+#define DL_MAX_PATCH_BLOCKS 8      // Max number of blocks to patch per patch data
+#define DL_MAX_PATCHES 4           // Max patches to use
+#define DL_MAX_EXPORT_COUNT 64     // size of the symbol export table
+
+#define DL_MAX_COMBINED_KERNELS 64       // Max number of kernels in cache
+#define DL_MAX_SYMBOLS 100               // max number of import/export symbols in a combined kernels
+#define DL_MAX_KERNEL_SIZE (128 * 1024)  // max output kernel size
+
+#define DL_CSC_MAX 6                      // 6 CSC matrices max
+#define DL_MAX_SEARCH_NODES_PER_KERNEL 6  // max number of search nodes for a component kernel (max tree depth)
+#define DL_MAX_COMPONENT_KERNELS 25       // max number of component kernels that can be combined
+
+#define DL_DEFAULT_COMBINED_KERNELS 4                                                  // Default number of kernels in cache
+#define DL_NEW_COMBINED_KERNELS 4                                                      // The increased number of kernels in cache each time
+#define DL_CACHE_BLOCK_SIZE (128 * 1024)                                               // Kernel allocation block size
+#define DL_COMBINED_KERNEL_CACHE_SIZE (DL_CACHE_BLOCK_SIZE * DL_NEW_COMBINED_KERNELS)  // Combined kernel size
+
+#define DL_PROCAMP_DISABLED -1  // procamp is disabled
+#define DL_PROCAMP_MAX 1        // 1 Procamp entry
+
+#define DL_CSC_DISABLED -1  // CSC is disabled
+
+#define DL_CSC_MAX_G5 2  // 2 CSC matrices max for Gen5
+
+#define DL_CHROMASITING_DISABLE -1  // Chromasiting is disabled
+
+#ifdef __cplusplus
+extern "C" {
+#endif  // __cplusplus
+
+typedef enum _MEDIA_CSPACE Kdll_CSpace;
+
+#define LumaKey_False 0
+
+// Parameters for RID_Op_NewEntry
+#define RULE_DEFAULT 0
+#define RULE_CUSTOM 1
+#define RULE_NO_OVERRIDE 255
+
+#define GROUP_DEFAULT RULE_DEFAULT
+#define GROUP_CUSTOM RULE_CUSTOM
+#define GROUP_NO_OVERRIDE RULE_NO_OVERRIDE
+
+#define ColorFill_Source -1
+#define ColorFill_False 0
+#define ColorFill_True 1
+
+#define LumaKey_Source -1
+
+#define LumaKey_True 1
+
+#define Procamp_Source -1
+
+// Dynamic Linking rule definitions
+#define RID_IS_MATCH(rid) ((rid & 0xFE00) == 0x0000)
+#define RID_IS_SET(rid) ((rid & 0xFE00) == 0x0200)
+#define RID_IS_EXTENDED(rid) ((rid & 0xFD00) == 0x0100)
+
+// Rotation Mode
+typedef enum tagKdll_Rotation
+{
+    Rotate_Source
+} Kdll_Rotation;
+
+// Kernel patches
+typedef enum tagKdll_PatchKind
+{
+    PatchKind_None           = 0,
+    PatchKind_CSC_Coeff_Src0 = 1,
+    PatchKind_CSC_Coeff_Src1 = 2,
+} Kdll_PatchKind;
+
+// Patch rule entry (rule extension)
+typedef struct tagKdll_PatchRuleEntry
+{
+    uint32_t Dest : 16;   // Patch destination in bytes (LSB)
+    uint32_t Source : 8;  // Patch data source in bytes
+    uint32_t Size : 8;    // Patch size in bytes (MSB)
+} Kdll_PatchRuleEntry;
+
+extern const char *g_cInit_ComponentNames[];
+
+//------------------------------------------------------------
+// KERNEL CACHE / LINK
+//------------------------------------------------------------
+// Import/export structure from kernel binary file
+#pragma pack(4)
+typedef struct tagKdll_LinkFileHeader
+{
+    uint32_t dwVersion;
+    uint32_t dwSize;
+    uint32_t dwImports;
+    uint32_t dwExports;
+} Kdll_LinkFileHeader;
+#pragma pack()
+
+const float g_cCSC_sRGB_stRGB[12] =
+    {
+        0.858824f, 0.000000f, 0.000000f, 16.000000f,  // stR = C0 * sR + C1 * sG + C2  * sB + C3
+        0.000000f,
+        0.858824f,
+        0.000000f,
+        16.000000f,  // stG = C4 * sR + C5 * sG + C6  * sB + C7
+        0.000000f,
+        0.000000f,
+        0.858824f,
+        16.000000f  // stB = C8 * sR + C9 * sG + C10 * sB + C11
+};
+
+const float g_cCSC_stRGB_sRGB[12] =
+    {
+        1.164384f, 0.000000f, 0.000000f, -18.630137f,  // sR   = C0 * stR + C1 * stG + C2  * stB + C3
+        0.000000f,
+        1.164384f,
+        0.000000f,
+        -18.630137f,  // sG   = C4 * stR + C5 * stG + C6  * stB + C7
+        0.000000f,
+        0.000000f,
+        1.164384f,
+        -18.630137f  // sB   = C8 * stR + C9 * stG + C10 * stB + C11
+};
+
+const float g_cCSC_Identity[12] =
+    {
+        1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f};
+
+// Generic RGB to YUV conversion matrix from BT.601 standard
+const float g_cCSC_BT601_RGB_YUV[9] =
+    {
+        0.299000f, 0.587000f, 0.114000f, -0.168736f, -0.331264f, 0.500000f, 0.500000f, -0.418688f, -0.081312f};
+
+// Generic RGB to YUV conversion matrix from BT.709 standard
+const float g_cCSC_BT709_RGB_YUV[9] =
+    {
+        0.212600f, 0.715200f, 0.072200f, -0.114572f, -0.385428f, 0.500000f, 0.500000f, -0.454153f, -0.045847f};
+
+// Generic YUV to RGB conversion matrix from BT.601 standard
+const float g_cCSC_BT601_YUV_RGB[9] =
+    {
+        1.000000f, 0.000000f, 1.402000f, 1.000000f, -0.344136f, -0.714136f, 1.000000f, 1.772000f, 0.000000f};
+
+// Generic YUV to RGB conversion matrix from BT.709 standard
+const float g_cCSC_BT709_YUV_RGB[9] =
+    {
+        1.000000f, 0.000000f, 1.574800f, 1.000000f, -0.187324f, -0.468124f, 1.000000f, 1.855600f, 0.000000f};
+// BT2020 RGB to Non-constant YUV conversion matrix from R-REC-BT.2020-1-201406-I!!PDF-E.pdf
+const float g_cCSC_BT2020_RGB_YUV[9] =
+    {
+        0.262700f, 0.678000f, 0.059300f,  // Y
+        -0.139630f,
+        -0.360370f,
+        0.500000f,  // U
+        0.500000f,
+        -0.459786f,
+        -0.040214f  // V
+};
+
+// BT2020 Non-constant YUV to RGB conversion matrix from R-REC-BT.2020-1-201406-I!!PDF-E.pdf
+const float g_cCSC_BT2020_YUV_RGB[9] =
+    {
+        1.000000f, 0.000000f, 1.474600f,  //R
+        1.000000f,
+        -0.164553f,
+        -0.571353f,  //G
+        1.000000f,
+        1.881400f,
+        0.000000f  //B
+};
+
+// Layer definition
+typedef enum _KDLL_LAYER
+{
+    Layer_Invalid      = -2,  // Invalid
+    Layer_None         = -1,  // None
+    Layer_Background   = 0,   // Background      (0)
+    Layer_MainVideo    = 1,   // Main video      (1)
+    Layer_SubVideo     = 2,   // Secondary video (2)
+    Layer_SubPicture1  = 3,   // Sub-picture 1   (3)
+    Layer_SubPicture2  = 4,   // Sub-picture 2   (4)
+    Layer_SubPicture3  = 5,   // Sub-picture 3   (5) [Gen6]
+    Layer_SubPicture4  = 6,   // Sub-picture 4   (6) [Gen6]
+    Layer_Graphics     = 14,  // Graphics        (7)
+    Layer_RenderTarget = 15   // Render Target
+} Kdll_Layer;
+
+// Sampling mode
+// Please don't change the order in the enum is setup
+typedef enum tagKdll_Sampling
+{
+    Sample_None   = -2,
+    Sample_Source = -1,  // Current source sampling
+    Sample_Any    = 0,
+    Sample_Scaling_Any,    // Scaling (any scaling factor)
+    Sample_Scaling,        // Scaling (above or equal 0.34x)
+    Sample_Scaling_034x,   // Scaling 0.34x (below 0.34x)
+    Sample_iScaling,       // Scaling (above or equal 0.34x)
+    Sample_iScaling_034x,  // Scaling 0.34x (below 0.34x)
+    Sample_iScaling_AVS,   //AVS Interlace Scaling on g75+
+    Sample_Scaling_AVS,    // AVS Scaling on g575+
+} Kdll_Sampling;
+
+// scaling ratio mode
+typedef enum tagKdll_scalingratio
+{
+    Scalingratio_Any = 0,    // By default, or scaling ratio <=1/8
+    Scalingratio_over1,      // Scaling ratio > 1 +1/6;
+    Scalingratio_b1p2to1,    // Scaling ratio (1/2, 1+1/6]; //NV12 need 1+1/6 support by kernel
+    Scalingratio_b1p4to1p2,  // Scaling ratio (1/4, 1/2];
+    Scalingratio_b1p8to1p4,  // Scaling ratio (1/8, 1/4]
+} Kdll_Scalingratio;
+
+// Gen7+ : Shuffle data returned by Sample_8x8 message
+typedef enum tagKdll_Shuffling
+{
+    Shuffle_None = -1,
+    Shuffle_Any  = 0,
+    Shuffle_All_8x8_Layer,  // Mix of Sample_8x8 and others. Shuffle all 8x8 layer.
+    Shuffle_RenderTarget    // All layers are Sample_8x8. Shuffle only in RenderTarget
+} Kdll_Shuffling;
+
+// Gen7+ : Rendering method
+typedef enum tagKdll_RenderMethod
+{
+    RenderMethod_MediaObject       = 0,
+    RenderMethod_MediaObjectWalker = 1
+} Kdll_RenderMethod;
+
+// Gen7+ : Set CSC Coefficients method
+typedef enum tagKdll_SetCSCCoeffMethod
+{
+    SetCSCCoeffMethod_Curbe = 0,
+    SetCSCCoeffMethod_Patch = 1
+} Kdll_SetCSCCoeffMethod;
+
+// Processing mode
+typedef enum tagKdll_Processing
+{
+    Process_None   = -2,
+    Process_Source = -1,  // Current source processing
+    Process_Any    = 0,
+    Process_Composite,     // Composite 2 layers
+    Process_XORComposite,  // XOR mono composite.
+    Process_PBlend,        // Partial Blend 2 layers  - 8-bits alpha
+    Process_CBlend,        // Constant Blend 2 layers - 8-bits alpha
+    Process_SBlend,        // Source Blend 2 layers   - 8-bits alpha
+    Process_SBlend_4bits,  // Source Blend 2 layers   - 4-bits alpha
+    Process_CSBlend,       // Constant multiply Source Blend 2 layers - 8-bits alpha (Source is NOT premultiplied)
+    Process_CPBlend,       // Constant multiply Source Blend 2 layers - 8-bits alpha (Source is Premultiplied)
+    Process_DI,            // Deinterlacing
+    Process_DN,            // Denoise
+    Process_DNDI           // DNDI
+} Kdll_Processing;
+
+typedef enum tagKdll_CSCType
+{
+    CSC_YUV_RGB = 0,  // YUV to RGB color space conversion
+    CSC_RGB_YUV = 1,  // RGB to YUV color space conversion
+    CSC_YUV_YUV = 2,  // YUV to YUV color space conversion
+    CSC_RGB_RGB = 3   // RGB to RGB color space conversion
+} Kdll_CSCType;
+
+// CSC Coefficients ID
+// Worst case we could have any many CSCs are there are number of layers (xvYcc case). So, 6 CoeffIDs defined to support 6 layers max
+typedef enum tagKdll_CoeffID
+{
+    CoeffID_Src0   = -5,  // Src0 coefficients
+    CoeffID_Src1   = -4,  // Src1 coefficients
+    CoeffID_Source = -3,  // Current source coefficients
+    CoeffID_Any    = -2,  // Any matrix
+    CoeffID_None   = -1,  // No matrix -> no CSC
+    CoeffID_0      = 0,
+    CoeffID_1      = 1,
+    CoeffID_2      = 2,
+    CoeffID_3      = 3,
+    CoeffID_4      = 4,
+    CoeffID_5      = 5
+} Kdll_CoeffID;
+
+// DL Parser State
+typedef enum tagKdll_ParserState
+{
+    Parser_Invalid = -1,           // invalid state
+    Parser_Begin   = 0,            // start dynamic linking
+    Parser_SetRenderMethod,        // MEDIA_OBJECT or MEDIA_OBJECT_WALKER rendering
+    Parser_SetupLayer0,            // setup layer 0
+    Parser_SetupLayer1,            // setup layer 1
+    Parser_SetParamsLayer0,        // setup parameters for layer 0
+    Parser_SetParamsLayer1,        // setup parameters for layer 1
+    Parser_SetParamsTarget,        // setup parameters for render target
+    Parser_SampleLayer0,           // sample layer 0
+    Parser_SampleLayer0Mix,        // sample layer 0 need inter mix (interlaced scaling)
+    Parser_SampleLayer0ColorFill,  // sample layer 0 colorfill
+    Parser_RotateLayer0Check,      // check if layer 0 needs preComp rotation
+    Parser_RotateLayer0,           // PreComp layer 0 rotate
+    Parser_SampleLayer0Done,       // sample layer 0 is complete
+    Parser_ShuffleLayer0,          // shuffle layer 0
+    Parser_SampleLayer1,           // sample layer 1
+    Parser_SampleLayer1Done,       // sample layer 1 is complete
+    Parser_ShuffleLayer1,          // shuffle layer 1
+    Parser_SampleLayer0SelectCSC,  // decided whether CSC be selected for Mix or jump to Parser_SampleLayer0Mix directly
+    Parser_SetupCSC0,              // CSC parameters setup for layer 0
+    Parser_ExecuteCSC0,            // CSC on layer 0
+    Parser_ExecuteCSC0Done,        // CSC on layer 0 is complete
+    Parser_SetupCSC1,              // CSC parameter setup for layer 1
+    Parser_ExecuteCSC1,            // CSC on layer 1
+    Parser_ExecuteCSC1Done,        // CSC on layer 1 is complete
+    Parser_Lumakey,                // lumakey
+    Parser_ProcessLayer,           // process layer 0 + layer 1
+    Parser_ProcessLayerDone,       // processing is complete
+    Parser_DualOutput,             // dual output
+    Parser_Rotation,               // apply post composition rotation
+    Parser_DestSurfIndex,          // destination surface index
+    Parser_Colorfill,              // applying colorfill
+    Parser_WriteOutput,            // write output
+    Parser_End,                    // end dynamic linking
+
+    // This is used for custom states
+    Parser_Custom,  // Custom state
+
+    // Number of states - keep this at the end
+    Parser_Count
+} Kdll_ParserState;
+
+typedef enum tagKdll_RuleID
+{
+    // Parser/Patch Control
+    RID_Op_EOF      = -2,  // End of search table
+    RID_Op_NewEntry = -1,  // New search entry
+
+    // Simple Match Rules - 0x0000 to 0x0100
+    RID_IsTargetCspace = 0,    // Match target color space
+    RID_IsLayerID,             // Match Layer ID
+    RID_IsLayerFormat,         // Match Layer Format
+    RID_IsParserState,         // Match Parser State
+    RID_IsRenderMethod,        // Match rendering mode, media object or media walker
+    RID_IsShuffling,           // Match Shuffling
+    RID_IsDualOutput,          // Match Dual Output
+    RID_IsLayerRotation,       // Match Rotation
+    RID_IsRTRotate,            // Match if RT rotates
+    RID_IsSrc0Format,          // Current Src0 source (surface) format
+    RID_IsSrc0Sampling,        // Current Src0 sampling mode
+    RID_IsSrc0Rotation,        // Match Layer0 Rotation
+    RID_IsSrc0ColorFill,       // Current Src0 Colorfill flag
+    RID_IsSrc0LumaKey,         // Current Src0 LumaKey flag
+    RID_IsSrc0Procamp,         // Match Src0 Procamp flag
+    RID_IsSrc0Coeff,           // Current Src0 CSC coefficients
+    RID_IsSrc0Processing,      // Current Src0 processing mode
+    RID_IsSrc0Chromasiting,    // Current Src0 Chromasiting mode
+    RID_IsSrc1Format,          // Current Src1 source (surface) format
+    RID_IsSrc1Sampling,        // Current Src1 sampling mode
+    RID_IsSrc1LumaKey,         // Current Src1 LumaKey flag
+    RID_IsSrc1SamplerLumaKey,  // Current Src1 Samper LumaKey flag
+    RID_IsSrc1Procamp,         // Match Src1 Procamp flag
+    RID_IsSrc1Coeff,           // Current Src1 CSC coefficients
+    RID_IsSrc1Processing,      // Current Src1 processing mode
+    RID_IsSrc1Chromasiting,    // Current Src1 Chromasiting mode
+    RID_IsLayerNumber,         // Current Layer number
+    RID_IsQuadrant,            // Current Quadrant
+    RID_IsCSCBeforeMix,        // CSC needed before Mix
+    RID_IsTargetFormat,        // Render Target Format
+    RID_Is64BSaveEnabled,      // Indicate whether 64B save kernel could be used
+    RID_IsTargetTileType,      // Render Target Tile Type
+    RID_IsProcampEnabled,      // Match Procamp
+    RID_IsSetCoeffMode,        // Set CSC coefficients mode
+    RID_IsConstOutAlpha,       // Match alpha fill mode
+    RID_IsDitherNeeded,        // Whether dithering needed
+    RID_IsScalingRatio,        // Current scaling ratio
+    // Extended Match Rules - 0x0100 to 0x01ff
+
+    // Simple Set Rules - 0x0200 to 0x02ff
+    RID_SetTargetCspace = 512,  // Set target color space
+    RID_SetParserState,         // Set Parser State
+    RID_SetSrc0Format,          // Set Src0 source format
+    RID_SetSrc0Sampling,        // Set Src0 sampling mode
+    RID_SetSrc0Rotation,        // Set Src0 rotation
+    RID_SetSrc0ColorFill,       // Set Src0 Colorfill
+    RID_SetSrc0LumaKey,         // Set Src0 LumaKey
+    RID_SetSrc0Procamp,         // Set Src0 Procamp flag
+    RID_SetSrc0Coeff,           // Set Src0 CSC coefficients
+    RID_SetSrc0Processing,      // Set Src0 Processing mode
+    RID_SetSrc1Format,          // Set Src1 source format
+    RID_SetSrc1Sampling,        // Set Src1 sampling mode
+    RID_SetSrc1Rotation,        // Set Src1 rotation
+    RID_SetSrc1LumaKey,         // Set Src1 LumaKey
+    RID_SetSrc1SamplerLumaKey,  // Set Src1 Sampler LumaKey
+    RID_SetSrc1Procamp,         // Set Src1 Procamp flag
+    RID_SetSrc1Coeff,           // Set Src1 CSC coefficients
+    RID_SetSrc1Processing,      // Set Src1 Processing mode
+    RID_SetKernel,              // Set Kernel
+    RID_SetNextLayer,           // Set Next Layer
+    RID_SetPatchData,           // Set Patch Data to use
+    RID_SetQuadrant,            // Set Quadrant
+    RID_SetCSCBeforeMix,        // Set CSC flag before Mix
+
+    // Extended Set Rules - 0x0300 to 0x03ff
+    RID_SetPatch = 768,  // Set Patch block
+} Kdll_RuleID;
+
+typedef enum tagKdll_Logic
+{
+    Kdll_None,
+    Kdll_Or,
+    Kdll_Not,
+} Kdll_Logic;
+
+// Dynamic linking rule entry
+typedef struct tagKdll_RuleEntry
+{
+    Kdll_RuleID id : 16;     // LSB
+    int         value : 16;  // MSB
+    Kdll_Logic  logic;
+} Kdll_RuleEntry;
+
+typedef struct tagKdll_RuleEntrySet
+{
+    const Kdll_RuleEntry *pRuleEntry;        // Pointer to the first meaningful rule of the set
+    uint32_t              iGroup : 8;        // Group (default, custom, non-overridable)
+    uint32_t              iMatchCount : 12;  // Size of Match Rules (including variable length rules)
+    uint32_t              iSetCount : 12;    // Size of Set Rules (including variable length rules)
+} Kdll_RuleEntrySet;
+
+// Structure that defines a set of procamp parameters
+typedef struct tagKdll_Procamp
+{
+    bool  bEnabled;         // Procamp Enabled/Disabled
+    int   iProcampVersion;  // Procamp parameters version
+    float fBrightness;      // Brightness : range = -100.0 - 100.0; default = 0.0; step = 0.1
+    float fContrast;        // Contrast   : range =    0.0 -  10.0; default = 1.0; step = 0.01
+    float fHue;             // Hue        : range = -180.0 - 180.0; default = 0.0; step = 0.1
+    float fSaturation;      // Saturation : range =    0.0 -  10.0; default = 1.0; step = 0.01
+} Kdll_Procamp;
+
+// Structure that defines CSC+PA conversion matrix
+typedef struct tagKdll_CSC_Matrix
+{
+    int bInUse : 1;  // Matrix is in use and valid (LSB)
+    int : 3;
+    Kdll_CoeffID iCoeffID : 4;     // Coeffient set
+    VPHAL_CSPACE SrcSpace : 8;     // Source Color Space
+    VPHAL_CSPACE DstSpace : 8;     // Destionation Color Space
+    int          iProcampID : 8;   // Procamp parameter set (-1 if no Procamp) (MSB)
+    int          iProcampVersion;  // Last procamp version (to recalculate matrix)
+    short        Coeff[12];        // CSC kernel coeff: [Y'/R']   [0  1  2]   [Y/R]   [ 3]
+                                   //                   [U'/G'] = [4  5  6] * [U/G] + [ 7]
+                                   //                   [V'/B']   [8  9 10]   [V/B]   [11]
+} Kdll_CSC_Matrix;
+
+// Structure that defines a full set of CSC or CSC+PA parameters to be used by a combined kernel
+typedef struct tagKdll_CSC_Params
+{
+    VPHAL_CSPACE    ColorSpace;                 // Selected Color Space
+    Kdll_CSC_Matrix Matrix[DL_CSC_MAX];         // CSC conversion matrix (3x3 + 1x3)
+    uint8_t         MatrixID[DL_CSC_MAX];       // Coefficient allocation array
+    uint8_t         PatchMatrixID[DL_CSC_MAX];  // CSC Matrix ID
+    uint8_t         PatchMatrixNum;             // CSC Matrix Number
+} Kdll_CSC_Params;
+
+// Structure that defines a compositing layer
+typedef struct tagKdll_FilterEntry
+{
+    // Current layer
+    Kdll_Layer      layer;            // source layer       (Layer identification - Bg, Main, Sub, Gfx, ...)
+    MOS_FORMAT      format;           // source format      (Pixel/Sampling Format - ARBG, NV12, YUY2, ...)
+    VPHAL_CSPACE    cspace;           // source color space (BT709, BT601, xvYCC709, xvYCC601, sRGB, ...)
+    Kdll_Sampling   sampler;          // sampling mode      (AVS, Scaling, ColorFill, Luma Keying, ...)
+    int32_t         colorfill : 16;   // colorfill          (true/false)
+    int32_t         lumakey : 16;     // Luma key           (true/false)
+    int32_t         samplerlumakey;   // Sampler Lumakey    (true/false)
+    Kdll_Processing process;          // processing mode    (Compositing, Constant Blending, Source Blending, ...)
+    int             procamp;          // index to procamp parameters (-1 of Procamp disabled)
+    int             matrix;           // index to CSC matrix entry   (-1 if CSC not required)
+    VPHAL_ROTATION  rotation;         // rotation angle
+    MOS_TILE_TYPE   tiletype;         // Tiling Type
+    bool            dualout;          // dual output mode
+    bool            bWaEnableDscale;  // enable DScale kernels for sampler-unrom issue
+    bool            bEnableDscale;    // always enable DScale Kernels
+    int32_t         chromasiting;     // chromasiting        (-1 if Chromasiting is disabled)
+
+    // This flag is used to select between kernels:
+    // Save_RGB         or     Save_ARGB
+    // Save_R10G10B10   or     Save_R10G10B10A2
+    // Save_VUYA        or     Save_SrcVUYA
+    bool bFillOutputAlphaWithConstant;
+    bool bIsDitherNeeded;
+
+    Kdll_Scalingratio      ScalingRatio;
+    Kdll_RenderMethod      RenderMethod;
+    Kdll_SetCSCCoeffMethod SetCSCCoeffMode;
+} Kdll_FilterEntry, *PKdll_FilterEntry;
+
+// Structure that defines a compositing filter
+typedef Kdll_FilterEntry Kdll_FilterDesc[DL_MAX_SEARCH_FILTER_SIZE];
+
+typedef struct tagKdll_PatchBlock
+{
+    uint32_t DstOffset : 16;
+    uint32_t SrcOffset : 8;
+    uint32_t BlockSize : 8;
+} Kdll_PatchBlock;
+
+// Kernel Patching data
+typedef struct tagKdll_PatchData
+{
+    // Data for patching
+    int     iPatchDataSize;                // Size of Patch data block
+    uint8_t Data[DL_MAX_PATCH_DATA_SIZE];  // Patch data
+
+    // Patches
+    int             nPatches;
+    Kdll_PatchBlock Patch[DL_MAX_PATCH_BLOCKS];
+} Kdll_PatchData;
+
+typedef struct tagKdll_LinkData
+{
+    uint32_t iKUID : 16;     // Kernel Unique ID
+    uint32_t iLabelID : 16;  // Label ID
+    uint32_t bExport : 1;    // 0 - import; 1 - export;
+    uint32_t bResolved : 1;  // 0 - unresolved; 1 - resolved;
+    uint32_t dwOffset : 20;  // Offset in DWORDs
+    uint32_t bInline : 1;    // 0 - function; 1 - inline;
+    uint32_t : 9;            // MBZ
+} Kdll_LinkData;
+
+typedef struct tagKdll_Symbol
+{
+    uint32_t       dwSize;
+    uint32_t       dwCount;
+    Kdll_LinkData *pLink;
+} Kdll_Symbol;
+
+typedef struct tagKdll_CacheEntry
+{
+    // Kernel binary
+    uint8_t *pBinary;  // kernel binary
+    int      iSize;    // kernel size
+
+    // Component kernel information
+    int            iKUID;   // kernel unique id (static kernel)
+    const char *   szName;  // kernel name
+    int            nLink;   // Number of imports/exports
+    Kdll_LinkData *pLink;   // Kernel imports/exports
+
+    // Combined kernel information
+    uint16_t          wHashEntry;        // hash table entry
+    int               iFilterSize;       // kernel filter size
+    Kdll_FilterEntry *pFilter;           // kernel filter description
+    Kdll_CSC_Params * pCscParams;        // kernel CSC parameters
+    VPHAL_CSPACE      colorfill_cspace;  // intermediate color space for colorfill
+
+    // Cache control
+    int      iKCID;      // kernel cache id (dynamically linked kernel)
+    uint32_t dwLoaded;   // kernel loaded flag
+    uint32_t dwRefresh;  // refresh counter (for expiration control)
+
+    struct tagKdll_CacheEntry *pNextEntry;  // Next cache entry;
+} Kdll_CacheEntry;
+
+typedef struct tagKdll_KernelCache
+{
+    int              iCacheMaxEntries;  // Max number of entries
+    int              iCacheEntries;     // Current number of cache entries
+    int              iCacheSize;        // Cache buffer size
+    int              iCacheFree;        // Cache buffer free
+    int              iCacheID;          // Next kernel cache ID
+    Kdll_CacheEntry *pCacheEntries;     // Array of kernel cache entries
+    uint8_t *        pCache;            // Cache (binary data)
+    int              nExports;          // Exports count
+    Kdll_LinkData *  pExports;          // Exports table
+} Kdll_KernelCache;
+
+//--------------------------------------------------------------
+// Kernel Hash table
+//--------------------------------------------------------------
+typedef struct tagKdll_KernelHashEntry
+{
+    uint16_t          next;         // Next entry with same 8-bit hash + 1 (0 is null)
+    uint32_t          dwHash;       // 32-bit hash value (FNV-1a hash)
+    int               iFilter;      // Filter size
+    Kdll_FilterEntry *pFilter;      // Filter for matching
+    Kdll_CacheEntry * pCacheEntry;  // Pointer to kernel cache entry
+} Kdll_KernelHashEntry;
+
+typedef struct tagKdll_KernelHashTable
+{
+    uint16_t             wHashTable[256];                     // 256 hashes (1 based index)
+    uint16_t             pool;                                // first in pool (1 based index)
+    uint16_t             last;                                // last in pool (for releasing)
+    Kdll_KernelHashEntry HashEntry[DL_MAX_COMBINED_KERNELS];  // Hash table entries
+} Kdll_KernelHashTable;
+
+//--------------------------------------------------------------
+// Dynamic linking state
+//--------------------------------------------------------------
+typedef struct tagKdll_State *      PKdll_State;
+typedef struct tagKdll_SearchState *PKdll_SearchState;
+
+typedef struct tagKdll_State
+{
+    int      iSize;        // Size of DL buffer
+    uint32_t dwRefresh;    // Refresh counter (for garbage collection)
+    bool     bEnableCMFC;  // Flag to enable CMFC
+
+    // Default kernel component cache and rule table
+    Kdll_KernelCache      ComponentKernelCache;  // Component kernels cache
+    const Kdll_RuleEntry *pRuleTableDefault;     // Default Dll rules (internal)
+
+    // CMFC kernel fcpatch cache
+    Kdll_KernelCache CmFcPatchCache;  // CMFC kernel fcpatch cache
+
+    // Custom kernel component cache and rule table
+    Kdll_KernelCache *    pCustomKernelCache;  // Custom kernel cache
+    const Kdll_RuleEntry *pRuleTableCustom;    // Custom Dll rules (external)
+
+    // Combined rule lookup table
+    Kdll_RuleEntrySet *pSortedRules;  // Sorted rule table
+
+    Kdll_RuleEntrySet *pDllRuleTable[Parser_Count];  // Rule acceleration table (one entry for each Parser State)
+    int                iDllRuleCount[Parser_Count];  // Rule count (number of entries for each Parser State)
+
+    // Combined kernel cache and hash table
+    Kdll_KernelCache     KernelCache;      // Output kernel cache
+    Kdll_KernelHashTable KernelHashTable;  // Hash table for resulting kernels
+
+    Kdll_Procamp *pProcamp;      // Array of Procamp parameters
+    int32_t       iProcampSize;  // Size of the array of Procamp parameters
+
+    // Colorfill
+    VPHAL_CSPACE colorfill_cspace;  // Selected colorfill Color Space by Kdll
+
+    // Start kernel search
+    void (*pfnStartKernelSearch)(PKdll_State pState,
+        PKdll_SearchState                    pSearchState,
+        Kdll_FilterEntry *                   pFilter,
+        int32_t                              iFilterSize,
+        uint32_t                             uiIs64BInstrEnabled);
+
+    // Find best ColorSpace to use internally, allocate/calculate CSC matrices and arguments
+    bool (*pfnSetupCSC)(PKdll_State pState,
+        PKdll_SearchState           pSearchState);
+
+    // Find rule that matches the current search state
+    bool (*pfnFindRule)(PKdll_State pState,
+        PKdll_SearchState           pSearchState);
+
+    // Update state based on rule
+    bool (*pfnUpdateState)(PKdll_State pState,
+        PKdll_SearchState              pSearchState);
+
+    // Search Kernel based for a given
+    bool (*pfnSearchKernel)(PKdll_State pState,
+        PKdll_SearchState               pSearchState);
+
+    // Build current best match kernel
+    bool (*pfnBuildKernel)(PKdll_State pState,
+        PKdll_SearchState              pSearchState);
+
+    // Map matrix to kernel CSC
+    bool (*pfnMapCSCMatrix)(Kdll_CSCType type,
+        const float *                    matrix,
+        short *                          coeff);
+#if EMUL
+    // Token to be passed back in Callbacks
+    void *pToken;
+
+    // Print Component Kernel
+    void (*pfnCbListKernel)(void *token,
+        const char *              szKernel);
+
+    // State update
+    void (*pfnCbSearchSate)(void *token,
+        int32_t                   reason,
+        PKdll_SearchState         pSearchState);
+#endif
+} Kdll_State;
+
+typedef struct tagKdll_SearchState
+{
+    // Kernel DLL state
+    Kdll_State *pKdllState;  // Kernel DLL State
+
+    // Filter and CSC parameters
+    Kdll_FilterDesc Filter;              // Output Filter, with CSC data
+    int             iFilterSize;         // Size of the filter
+    Kdll_CSC_Params CscParams;           // CSC parameters
+    bool            bCscBeforeMix;       // flag to identify if CSC needed before Mix
+    Kdll_Shuffling  ShuffleSamplerData;  // Gen7+ Shuffle sampler output
+
+    // RT Rotate
+    bool bRTRotate;
+
+    // Procamp
+    bool bProcamp;
+
+    // Search output
+    Kdll_RuleEntrySet *pMatchingRuleSet;  // Pointer to the matching rule set
+
+    // Kernels
+    int KernelCount;                // # of kernels
+    int KernelID[DL_MAX_KERNELS];   // Array of kernel ids
+    int KernelGrp[DL_MAX_KERNELS];  // Array of kernel groups
+    int PatchID[DL_MAX_KERNELS];    // Array of patches
+
+    // Kernel patches
+    int            PatchCount;               // Number of patches
+    Kdll_PatchData Patches[DL_MAX_PATCHES];  // Kernel patches
+
+    // Current state
+    Kdll_FilterEntry *pFilter;       // Current filter entry
+    Kdll_ParserState  state;         // Parser state
+    VPHAL_CSPACE      cspace;        // Destination color space
+    int               quadrant;      // Current quadrant
+    int               layer_number;  // Current layer number
+
+    // Src0 state
+    MOS_FORMAT      src0_format;     // Src0 source format
+    Kdll_Sampling   src0_sampling;   // Src0 sampling mode
+    int32_t         src0_colorfill;  // Src0 colorfill flag
+    int32_t         src0_lumakey;    // Src0 luma key
+    int32_t         src0_procamp;    // Src0 procamp
+    Kdll_CoeffID    src0_coeff;      // Src0 CSC coefficiants
+    Kdll_Processing src0_process;    // Src0 processing mode
+    VPHAL_ROTATION  src0_rotation;   // Src0 Rotate
+
+    // Src1 state
+    MOS_FORMAT      src1_format;          // Src1 source format
+    Kdll_Sampling   src1_sampling;        // Src1 sampling mode
+    int32_t         src1_lumakey;         // Src1 luma key
+    int32_t         src1_samplerlumakey;  // Src1 sampler luma key
+    int32_t         src1_procamp;         // Src1 procamp
+    Kdll_CoeffID    src1_coeff;           // Src1 CSC coefficients
+    Kdll_Processing src1_process;         // Src1 processing mode
+    VPHAL_ROTATION  src1_rotation;        // Src1 Rotate
+
+    // Render Target Format
+    MOS_FORMAT target_format;  // Render Target format
+
+    bool          b64BSaveEnabled;  // Whether to use 64B save kernel
+    MOS_TILE_TYPE target_tiletype;  // Render Target Tile Type
+
+    // Dynamic linking
+    int           KernelSize;                  // Kernel Size
+    int           KernelLeft;                  // Remaining size
+    Kdll_Symbol   KernelLink;                  // DL symbols for linking
+    Kdll_LinkData LinkArray[DL_MAX_SYMBOLS];   // Import/Export symbols for dynamic linking
+    uint8_t       Kernel[DL_MAX_KERNEL_SIZE];  // Output Kernel
+} Kdll_SearchState;
+
+void KernelDll_ModifyFunctionPointers_Next(Kdll_State *pState);
+
+//---------------------------------
+// Kernel DLL function prototypes
+//---------------------------------
+
+bool KernelDll_IsYUVFormat(MOS_FORMAT format);
+
+bool KernelDll_IsFormat(
+    MOS_FORMAT   format,
+    VPHAL_CSPACE cspace,
+    MOS_FORMAT   match);
+
+VPHAL_CSPACE KernelDll_TranslateCspace(VPHAL_CSPACE cspace);
+
+bool KernelDll_MapCSCMatrix(
+    Kdll_CSCType type,
+    const float *matrix,
+    short *      coeff);
+
+// Kernel Rule Search / State Update
+bool KernelDll_FindRule(
+    Kdll_State *      pState,
+    Kdll_SearchState *pSearchState);
+
+bool KernelDll_UpdateState(
+    Kdll_State *      pState,
+    Kdll_SearchState *pSearchState);
+
+bool KernelDll_IsCspace(
+    VPHAL_CSPACE cspace,
+    VPHAL_CSPACE match);
+
+void KernelDll_GetCSCMatrix(
+    Kdll_CSpace src,
+    Kdll_CSpace dst,
+    float *     pCSC_Matrix);
+
+//---------------------------------------------------------------------------------------
+// KernelDll_SetupFunctionPointers - Setup Function pointers based on platform
+//
+// Parameters:
+//    char  *pState    - [in] Kernel Dll state
+//           platform  - [in] platform
+//
+// Output: true  - Function pointers are set
+//         false - Failed to setup function pointers (invalid platform)
+//-----------------------------------------------------------------------------------------
+static bool KernelDll_SetupFunctionPointers(
+    Kdll_State *pState,
+    void (*ModifyFunctionPointers)(PKdll_State));
+
+// Allocate Kernel Dll State
+Kdll_State *KernelDll_AllocateStates(
+    void *                pKernelCache,
+    uint32_t              uKernelCacheSize,
+    void *                pFcPatchCache,
+    uint32_t              uFcPatchCacheSize,
+    const Kdll_RuleEntry *pInternalRules,
+    void (*ModifyFunctionPointers)(PKdll_State));
+
+// Release Kernel Dll State
+void KernelDll_ReleaseStates(Kdll_State *pState);
+
+// Update CSC coefficients
+void KernelDll_UpdateCscCoefficients(Kdll_State *pState,
+    Kdll_CSC_Matrix *                            pMatrix);
+
+//Release the additional kernel cache entries
+void KernelDll_ReleaseAdditionalCacheEntries(Kdll_KernelCache *pCache);
+
+// Search kernel, output is in pSearchState
+bool KernelDll_SearchKernel(
+    Kdll_State *      pState,
+    Kdll_SearchState *pSearchState);
+
+// Build kernel in SearchState
+bool KernelDll_BuildKernel(Kdll_State *pState, Kdll_SearchState *pSearchState);
+
+bool KernelDll_SetupCSC(
+    Kdll_State *      pState,
+    Kdll_SearchState *pSearchState);
+
+//---------------------------------------------------------------------------------------
+// KernelDll_SetupFunctionPointers_Ext - Setup Extension Function pointers
+//
+// Parameters:
+//    KdllState  *pState    - [in/out] Kernel Dll state
+//
+// Output: true  - Function pointers are set
+//         false - Failed to setup function pointers (invalid platform)
+//-----------------------------------------------------------------------------------------
+bool KernelDll_SetupFunctionPointers_Ext(
+    Kdll_State *pState);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // __HAL_KERNELDLL_NEXT_H__
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/vp/kdll/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/vp/kdll/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/vp/kdll/media_srcs.cmake	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/vp/kdll/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,37 @@
+# Copyright (c) 2021-2022, Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+set(TMP_HEADERS_ 
+    ${CMAKE_CURRENT_LIST_DIR}/hal_kerneldll_next.h
+)
+
+set(SOFTLET_VP_HEADERS_
+    ${SOFTLET_VP_HEADERS_}
+    ${TMP_HEADERS_}
+)
+
+source_group( "VpHalNext\\Kernel DLL" FILES ${TMP_HEADERS_} )
+set(TMP_HEADERS_ "")
+
+set (SOFTLET_VP_PRIVATE_INCLUDE_DIRS_
+    ${SOFTLET_VP_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
+
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/vp/kernel/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/vp/kernel/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/vp/kernel/media_srcs.cmake	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/vp/kernel/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,40 @@
+# Copyright (c) 2019-2022, Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+set(TMP_SOURCES_ "")
+
+
+set(TMP_HEADERS_
+    ${CMAKE_CURRENT_LIST_DIR}/vpkrnheader.h
+)
+
+
+set(VP_HEADERS_
+    ${VP_HEADERS_}
+    ${TMP_HEADERS_}
+)
+
+source_group( "VpHalNext\\Kernel DLL" FILES ${TMP_HEADERS_} )
+set(TMP_HEADERS_ "")
+
+set(VP_PRIVATE_INCLUDE_DIRS_
+    ${VP_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/vp/kernel/vpkrnheader.h 22.5.1+ds1-1/media_common/agnostic/common/vp/kernel/vpkrnheader.h
--- 22.4.3+ds1-1/media_common/agnostic/common/vp/kernel/vpkrnheader.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/vp/kernel/vpkrnheader.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,2957 @@
+/*
+ * Copyright (c) 2022, Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * 'Software'), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+////////////////////////////////////////////////////////////////////////////////
+// !!! WARNING - AUTO GENERATED FILE. DO NOT EDIT DIRECTLY. !!!
+// Generated by GenKrnBin.exe tool
+////////////////////////////////////////////////////////////////////////////////
+#ifndef __VPKRNHEADER_H__
+#define __VPKRNHEADER_H__
+
+#define IDR_VP_LINKFILE_VERSION 65536
+#define IDR_VP_LINKFILE_HEADER 16
+
+#define IDR_VP_1_1_16aligned 0
+#define IDR_VP_3DLUT 1
+#define IDR_VP_AlphaSrcBlendG 2
+#define IDR_VP_ApplyScaling 3
+#define IDR_VP_ByteCopy 4
+#define IDR_VP_ByteCopy_MediaWalker 5
+#define IDR_VP_CSC_16x16 6
+#define IDR_VP_CSC_444_16 7
+#define IDR_VP_CSC_4x4 8
+#define IDR_VP_CSC_8x8 9
+#define IDR_VP_CSC_Premultiplied_444_16 10
+#define IDR_VP_Call_AlphaSrcBlendG 11
+#define IDR_VP_Call_CSC 12
+#define IDR_VP_Call_CSC_Premultiplied 13
+#define IDR_VP_Call_ColorE 14
+#define IDR_VP_Call_Composite 15
+#define IDR_VP_Call_ConstBlend 16
+#define IDR_VP_Call_ConstSrcBlend 17
+#define IDR_VP_Call_GammaC 18
+#define IDR_VP_Call_Mirror_H_YUV 19
+#define IDR_VP_Call_Mirror_H_YUVA 20
+#define IDR_VP_Call_PartBlend 21
+#define IDR_VP_Call_SrcBlend 22
+#define IDR_VP_Call_SrcBlend_4bits 23
+#define IDR_VP_Call_XOR_Composite 24
+#define IDR_VP_Call_XOR_Mono_Composite 25
+#define IDR_VP_ColorE 26
+#define IDR_VP_Colorfill_444AVS16 27
+#define IDR_VP_Colorfill_444AVS16_ConstBlend 28
+#define IDR_VP_Colorfill_444AVS16_ConstSrcBlend 29
+#define IDR_VP_Colorfill_444AVS16_PartBlend 30
+#define IDR_VP_Colorfill_444AVS16_SrcBlend 31
+#define IDR_VP_Colorfill_444Scale16 32
+#define IDR_VP_Colorfill_444Scale16_ConstBlend 33
+#define IDR_VP_Colorfill_444Scale16_ConstSrcBlend 34
+#define IDR_VP_Colorfill_444Scale16_PartBlend 35
+#define IDR_VP_Colorfill_444Scale16_SrcBlend 36
+#define IDR_VP_Composite_444_16 37
+#define IDR_VP_Compute_Lumakey 38
+#define IDR_VP_Compute_Lumakey_Buf0123 39
+#define IDR_VP_ConstBlend_444_16 40
+#define IDR_VP_ConstSrcBlend_444_16 41
+#define IDR_VP_CopyKernel_1D_to_2D_NV12_genx 42
+#define IDR_VP_CopyKernel_1D_to_2D_RGBP_genx 43
+#define IDR_VP_CopyKernel_1D_to_2D_genx 44
+#define IDR_VP_CopyKernel_2D_to_1D_NV12_genx 45
+#define IDR_VP_CopyKernel_2D_to_1D_RGBP_genx 46
+#define IDR_VP_CopyKernel_2D_to_1D_genx 47
+#define IDR_VP_CopyKernel_2D_to_2D_NV12_genx 48
+#define IDR_VP_CopyKernel_2D_to_2D_RGBP_genx 49
+#define IDR_VP_CopyKernel_2D_to_2D_genx 50
+#define IDR_VP_DP_FC_Setup_Walker_16x16 51
+#define IDR_VP_DP_FC_Setup_Walker_4x4 52
+#define IDR_VP_DP_FC_Setup_Walker_8x8 53
+#define IDR_VP_EOT 54
+#define IDR_VP_FMD_Summation 55
+#define IDR_VP_FRC_Clean_Map 56
+#define IDR_VP_FRC_GMV_Detection 57
+#define IDR_VP_FRC_GMV_Sanity_Check 58
+#define IDR_VP_FRC_GradUV 59
+#define IDR_VP_FRC_GradY 60
+#define IDR_VP_FRC_MC 61
+#define IDR_VP_FRC_ME_Level1 62
+#define IDR_VP_FRC_ME_Level2 63
+#define IDR_VP_FRC_ME_Level3 64
+#define IDR_VP_FRC_MV_Level1 65
+#define IDR_VP_FRC_MV_Level2 66
+#define IDR_VP_FRC_MV_Level3 67
+#define IDR_VP_FRC_PS 68
+#define IDR_VP_FRC_SPD_Map 69
+#define IDR_VP_FRC_TempDiff 70
+#define IDR_VP_FRC_TempDiff_HD 71
+#define IDR_VP_FRC_WSD 72
+#define IDR_VP_GammaC 73
+#define IDR_VP_GeoCorrection 74
+#define IDR_VP_HDR_mandatory 75
+#define IDR_VP_HDR_per_frame_stat 76
+#define IDR_VP_HDR_preprocess 77
+#define IDR_VP_IS_DS 78
+#define IDR_VP_IS_FW 79
+#define IDR_VP_IS_GMC 80
+#define IDR_VP_IS_ME 81
+#define IDR_VP_Interlace_420_16_Buf_0 82
+#define IDR_VP_Interlace_420_16_Buf_1 83
+#define IDR_VP_Interlace_420_16_Buf_2 84
+#define IDR_VP_Interlace_420_16_Buf_3 85
+#define IDR_VP_Interlace_444AVS16_Buf_0 86
+#define IDR_VP_Interlace_444AVS16_Buf_1 87
+#define IDR_VP_Interlace_444AVS16_Buf_2 88
+#define IDR_VP_Interlace_444AVS16_Buf_3 89
+#define IDR_VP_Interlace_444_16_Buf_0 90
+#define IDR_VP_Interlace_444_16_Buf_1 91
+#define IDR_VP_Interlace_444_16_Buf_2 92
+#define IDR_VP_Interlace_444_16_Buf_3 93
+#define IDR_VP_LACE_HIST_SUM 94
+#define IDR_VP_LACE_LUT 95
+#define IDR_VP_LACE_PWLF 96
+#define IDR_VP_LACE_STD 97
+#define IDR_VP_LinkFile 98
+#define IDR_VP_Mirror_AVS_H_L0 99
+#define IDR_VP_Mirror_AVS_V_L0 100
+#define IDR_VP_Mirror_H_YUV 101
+#define IDR_VP_Mirror_H_YUVA 102
+#define IDR_VP_Mirror_scale_H_L0 103
+#define IDR_VP_Mirror_scale_V_L0 104
+#define IDR_VP_NV12_DP_DownScaling_4x4 105
+#define IDR_VP_NV12_DP_DownScaling_4x4_mirror_h 106
+#define IDR_VP_NV12_DP_DownScaling_4x4_mirror_v 107
+#define IDR_VP_NV12_DP_DownScaling_4x4_rot_180 108
+#define IDR_VP_NV12_DP_DownScaling_4x4_rot_270 109
+#define IDR_VP_NV12_DP_DownScaling_4x4_rot_90 110
+#define IDR_VP_NV12_DP_DownScaling_4x4_rot_90_mirror_h 111
+#define IDR_VP_NV12_DP_DownScaling_4x4_rot_90_mirror_v 112
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_1_8th 113
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_1_8th_mirror_h 114
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_1_8th_mirror_v 115
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_1_8th_rot_180 116
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_1_8th_rot_270 117
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_1_8th_rot_90 118
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_1_8th_rot_90_mirror_h 119
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_1_8th_rot_90_mirror_v 120
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_to_any_ratio 121
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_to_any_ratio_mirror_h 122
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_to_any_ratio_mirror_v 123
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_to_any_ratio_rot_180 124
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_to_any_ratio_rot_270 125
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_to_any_ratio_rot_90 126
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_to_any_ratio_rot_90_mirror_h 127
+#define IDR_VP_NV12_DP_DownScaling_4x4_scale_to_any_ratio_rot_90_mirror_v 128
+#define IDR_VP_NV12_DP_DownScaling_8x8 129
+#define IDR_VP_NV12_DP_DownScaling_8x8_mirror_h 130
+#define IDR_VP_NV12_DP_DownScaling_8x8_mirror_v 131
+#define IDR_VP_NV12_DP_DownScaling_8x8_rot_180 132
+#define IDR_VP_NV12_DP_DownScaling_8x8_rot_270 133
+#define IDR_VP_NV12_DP_DownScaling_8x8_rot_90 134
+#define IDR_VP_NV12_DP_DownScaling_8x8_rot_90_mirror_h 135
+#define IDR_VP_NV12_DP_DownScaling_8x8_rot_90_mirror_v 136
+#define IDR_VP_NV12_DP_UpScaling_16x16 137
+#define IDR_VP_NV12_DP_UpScaling_16x16_mirror_h 138
+#define IDR_VP_NV12_DP_UpScaling_16x16_mirror_v 139
+#define IDR_VP_NV12_DP_UpScaling_16x16_rot_180 140
+#define IDR_VP_NV12_DP_UpScaling_16x16_rot_270 141
+#define IDR_VP_NV12_DP_UpScaling_16x16_rot_90 142
+#define IDR_VP_NV12_DP_UpScaling_16x16_rot_90_mirror_h 143
+#define IDR_VP_NV12_DP_UpScaling_16x16_rot_90_mirror_v 144
+#define IDR_VP_NV12_DP_rotation_avg 145
+#define IDR_VP_NV12_DP_rotation_nv12 146
+#define IDR_VP_NV12_DP_rotation_rep 147
+#define IDR_VP_P010_444Dscale16_Buf_0 148
+#define IDR_VP_P010_444Dscale16_Buf_0_Rot_180 149
+#define IDR_VP_P010_444Dscale16_Buf_0_Rot_270 150
+#define IDR_VP_P010_444Dscale16_Buf_0_Rot_90 151
+#define IDR_VP_P010_444Dscale16_Buf_1 152
+#define IDR_VP_P010_444Dscale16_Buf_1_Rot_180 153
+#define IDR_VP_P010_444Dscale16_Buf_1_Rot_270 154
+#define IDR_VP_P010_444Dscale16_Buf_1_Rot_90 155
+#define IDR_VP_P010_444Dscale16_Buf_2 156
+#define IDR_VP_P010_444Dscale16_Buf_2_Rot_180 157
+#define IDR_VP_P010_444Dscale16_Buf_2_Rot_270 158
+#define IDR_VP_P010_444Dscale16_Buf_2_Rot_90 159
+#define IDR_VP_P010_444Dscale16_Buf_3 160
+#define IDR_VP_P010_444Dscale16_Buf_3_Rot_180 161
+#define IDR_VP_P010_444Dscale16_Buf_3_Rot_270 162
+#define IDR_VP_P010_444Dscale16_Buf_3_Rot_90 163
+#define IDR_VP_PA_444AVS16_Buf_0 164
+#define IDR_VP_PA_444AVS16_Buf_0_Rot_180 165
+#define IDR_VP_PA_444AVS16_Buf_0_Rot_270 166
+#define IDR_VP_PA_444AVS16_Buf_0_Rot_90 167
+#define IDR_VP_PA_444AVS16_Buf_1 168
+#define IDR_VP_PA_444AVS16_Buf_1_Rot_180 169
+#define IDR_VP_PA_444AVS16_Buf_1_Rot_270 170
+#define IDR_VP_PA_444AVS16_Buf_1_Rot_90 171
+#define IDR_VP_PA_444AVS16_Buf_2 172
+#define IDR_VP_PA_444AVS16_Buf_2_Rot_180 173
+#define IDR_VP_PA_444AVS16_Buf_2_Rot_270 174
+#define IDR_VP_PA_444AVS16_Buf_2_Rot_90 175
+#define IDR_VP_PA_444AVS16_Buf_3 176
+#define IDR_VP_PA_444AVS16_Buf_3_Rot_180 177
+#define IDR_VP_PA_444AVS16_Buf_3_Rot_270 178
+#define IDR_VP_PA_444AVS16_Buf_3_Rot_90 179
+#define IDR_VP_PA_444AVS16_Buf_4 180
+#define IDR_VP_PA_444AVS16_Buf_4_Rot_180 181
+#define IDR_VP_PA_444AVS16_Buf_4_Rot_270 182
+#define IDR_VP_PA_444AVS16_Buf_4_Rot_90 183
+#define IDR_VP_PA_444AVS16_Buf_5 184
+#define IDR_VP_PA_444AVS16_Buf_5_Rot_180 185
+#define IDR_VP_PA_444AVS16_Buf_5_Rot_270 186
+#define IDR_VP_PA_444AVS16_Buf_5_Rot_90 187
+#define IDR_VP_PA_444AVS16_HDC_DW_PLANAR_420_8_Buf_0 188
+#define IDR_VP_PA_444AVS16_HDC_DW_PLANAR_420_8_Buf_1 189
+#define IDR_VP_PA_444AVS16_HDC_DW_PLANAR_420_8_Buf_2 190
+#define IDR_VP_PA_444AVS16_HDC_DW_PLANAR_420_8_Buf_3 191
+#define IDR_VP_PA_444AVS16_HDC_DW_Y8_UNORM_Buf_0 192
+#define IDR_VP_PA_444AVS16_HDC_DW_Y8_UNORM_Buf_1 193
+#define IDR_VP_PA_444AVS16_HDC_DW_Y8_UNORM_Buf_2 194
+#define IDR_VP_PA_444AVS16_HDC_DW_Y8_UNORM_Buf_3 195
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_NORMAL_Buf_0 196
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_NORMAL_Buf_1 197
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_NORMAL_Buf_2 198
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_NORMAL_Buf_3 199
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPUVY_Buf_0 200
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPUVY_Buf_1 201
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPUVY_Buf_2 202
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPUVY_Buf_3 203
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPUV_Buf_0 204
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPUV_Buf_1 205
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPUV_Buf_2 206
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPUV_Buf_3 207
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPY_Buf_0 208
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPY_Buf_1 209
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPY_Buf_2 210
+#define IDR_VP_PA_444AVS16_HDC_DW_YCRCB_SWAPY_Buf_3 211
+#define IDR_VP_PA_444DScale16_Buf_0 212
+#define IDR_VP_PA_444DScale16_Buf_0_Rot_180 213
+#define IDR_VP_PA_444DScale16_Buf_0_Rot_270 214
+#define IDR_VP_PA_444DScale16_Buf_0_Rot_90 215
+#define IDR_VP_PA_444DScale16_Buf_1 216
+#define IDR_VP_PA_444DScale16_Buf_1_Rot_180 217
+#define IDR_VP_PA_444DScale16_Buf_1_Rot_270 218
+#define IDR_VP_PA_444DScale16_Buf_1_Rot_90 219
+#define IDR_VP_PA_444DScale16_Buf_2 220
+#define IDR_VP_PA_444DScale16_Buf_2_Rot_180 221
+#define IDR_VP_PA_444DScale16_Buf_2_Rot_270 222
+#define IDR_VP_PA_444DScale16_Buf_2_Rot_90 223
+#define IDR_VP_PA_444DScale16_Buf_3 224
+#define IDR_VP_PA_444DScale16_Buf_3_Rot_180 225
+#define IDR_VP_PA_444DScale16_Buf_3_Rot_270 226
+#define IDR_VP_PA_444DScale16_Buf_3_Rot_90 227
+#define IDR_VP_PA_444DScale16_Buf_4 228
+#define IDR_VP_PA_444DScale16_Buf_4_Rot_180 229
+#define IDR_VP_PA_444DScale16_Buf_4_Rot_270 230
+#define IDR_VP_PA_444DScale16_Buf_4_Rot_90 231
+#define IDR_VP_PA_444DScale16_Buf_5 232
+#define IDR_VP_PA_444DScale16_Buf_5_Rot_180 233
+#define IDR_VP_PA_444DScale16_Buf_5_Rot_270 234
+#define IDR_VP_PA_444DScale16_Buf_5_Rot_90 235
+#define IDR_VP_PA_444Scale16_Buf_0 236
+#define IDR_VP_PA_444Scale16_Buf_0_Rot_180 237
+#define IDR_VP_PA_444Scale16_Buf_0_Rot_270 238
+#define IDR_VP_PA_444Scale16_Buf_0_Rot_90 239
+#define IDR_VP_PA_444Scale16_Buf_1 240
+#define IDR_VP_PA_444Scale16_Buf_1_Rot_180 241
+#define IDR_VP_PA_444Scale16_Buf_1_Rot_270 242
+#define IDR_VP_PA_444Scale16_Buf_1_Rot_90 243
+#define IDR_VP_PA_444Scale16_Buf_2 244
+#define IDR_VP_PA_444Scale16_Buf_2_Rot_180 245
+#define IDR_VP_PA_444Scale16_Buf_2_Rot_270 246
+#define IDR_VP_PA_444Scale16_Buf_2_Rot_90 247
+#define IDR_VP_PA_444Scale16_Buf_3 248
+#define IDR_VP_PA_444Scale16_Buf_3_Rot_180 249
+#define IDR_VP_PA_444Scale16_Buf_3_Rot_270 250
+#define IDR_VP_PA_444Scale16_Buf_3_Rot_90 251
+#define IDR_VP_PA_444Scale16_Buf_4 252
+#define IDR_VP_PA_444Scale16_Buf_4_Rot_180 253
+#define IDR_VP_PA_444Scale16_Buf_4_Rot_270 254
+#define IDR_VP_PA_444Scale16_Buf_4_Rot_90 255
+#define IDR_VP_PA_444Scale16_Buf_5 256
+#define IDR_VP_PA_444Scale16_Buf_5_Rot_180 257
+#define IDR_VP_PA_444Scale16_Buf_5_Rot_270 258
+#define IDR_VP_PA_444Scale16_Buf_5_Rot_90 259
+#define IDR_VP_PA_444iAVS16_Buf_0 260
+#define IDR_VP_PA_444iAVS16_Buf_1 261
+#define IDR_VP_PA_444iAVS16_Buf_2 262
+#define IDR_VP_PA_444iAVS16_Buf_3 263
+#define IDR_VP_PA_444iDScale16_Buf_0 264
+#define IDR_VP_PA_444iDScale16_Buf_1 265
+#define IDR_VP_PA_444iDScale16_Buf_2 266
+#define IDR_VP_PA_444iDScale16_Buf_3 267
+#define IDR_VP_PA_444iScale16_Buf_0 268
+#define IDR_VP_PA_444iScale16_Buf_0_Rot_180 269
+#define IDR_VP_PA_444iScale16_Buf_0_Rot_270 270
+#define IDR_VP_PA_444iScale16_Buf_0_Rot_90 271
+#define IDR_VP_PA_444iScale16_Buf_1 272
+#define IDR_VP_PA_444iScale16_Buf_1_Rot_180 273
+#define IDR_VP_PA_444iScale16_Buf_1_Rot_270 274
+#define IDR_VP_PA_444iScale16_Buf_1_Rot_90 275
+#define IDR_VP_PA_444iScale16_Buf_2 276
+#define IDR_VP_PA_444iScale16_Buf_2_Rot_180 277
+#define IDR_VP_PA_444iScale16_Buf_2_Rot_270 278
+#define IDR_VP_PA_444iScale16_Buf_2_Rot_90 279
+#define IDR_VP_PA_444iScale16_Buf_3 280
+#define IDR_VP_PA_444iScale16_Buf_3_Rot_180 281
+#define IDR_VP_PA_444iScale16_Buf_3_Rot_270 282
+#define IDR_VP_PA_444iScale16_Buf_3_Rot_90 283
+#define IDR_VP_PA_AVS_Mirror_H_L0 284
+#define IDR_VP_PA_AVS_Mirror_V_L0 285
+#define IDR_VP_PA_AVS_Rotate_90_Mirror_H_L0 286
+#define IDR_VP_PA_AVS_Rotate_90_Mirror_V_L0 287
+#define IDR_VP_PA_AVS_Rotate_L0_180 288
+#define IDR_VP_PA_AVS_Rotate_L0_270 289
+#define IDR_VP_PA_AVS_Rotate_L0_90 290
+#define IDR_VP_PA_Copy 291
+#define IDR_VP_PA_Scale_Mirror_H_L0 292
+#define IDR_VP_PA_Scale_Mirror_V_L0 293
+#define IDR_VP_PA_Scale_Rotate90_Mirror_H_L0 294
+#define IDR_VP_PA_Scale_Rotate90_Mirror_V_L0 295
+#define IDR_VP_PA_Scale_Rotate_L0_180 296
+#define IDR_VP_PA_Scale_Rotate_L0_270 297
+#define IDR_VP_PA_Scale_Rotate_L0_90 298
+#define IDR_VP_PL2_422AVS16_ChromaSiting_Buf_0 299
+#define IDR_VP_PL2_422AVS16_ChromaSiting_Buf_1 300
+#define IDR_VP_PL2_422AVS16_ChromaSiting_Buf_2 301
+#define IDR_VP_PL2_422AVS16_ChromaSiting_Buf_3 302
+#define IDR_VP_PL2_422AVS16_ChromaSiting_Buf_4 303
+#define IDR_VP_PL2_422AVS16_ChromaSiting_Buf_5 304
+#define IDR_VP_PL2_444AVS16_Buf_0 305
+#define IDR_VP_PL2_444AVS16_Buf_0_Rot_180 306
+#define IDR_VP_PL2_444AVS16_Buf_0_Rot_270 307
+#define IDR_VP_PL2_444AVS16_Buf_0_Rot_90 308
+#define IDR_VP_PL2_444AVS16_Buf_1 309
+#define IDR_VP_PL2_444AVS16_Buf_1_Rot_180 310
+#define IDR_VP_PL2_444AVS16_Buf_1_Rot_270 311
+#define IDR_VP_PL2_444AVS16_Buf_1_Rot_90 312
+#define IDR_VP_PL2_444AVS16_Buf_2 313
+#define IDR_VP_PL2_444AVS16_Buf_2_Rot_180 314
+#define IDR_VP_PL2_444AVS16_Buf_2_Rot_270 315
+#define IDR_VP_PL2_444AVS16_Buf_2_Rot_90 316
+#define IDR_VP_PL2_444AVS16_Buf_3 317
+#define IDR_VP_PL2_444AVS16_Buf_3_Rot_180 318
+#define IDR_VP_PL2_444AVS16_Buf_3_Rot_270 319
+#define IDR_VP_PL2_444AVS16_Buf_3_Rot_90 320
+#define IDR_VP_PL2_444AVS16_Buf_4 321
+#define IDR_VP_PL2_444AVS16_Buf_4_Rot_180 322
+#define IDR_VP_PL2_444AVS16_Buf_4_Rot_270 323
+#define IDR_VP_PL2_444AVS16_Buf_4_Rot_90 324
+#define IDR_VP_PL2_444AVS16_Buf_5 325
+#define IDR_VP_PL2_444AVS16_Buf_5_Rot_180 326
+#define IDR_VP_PL2_444AVS16_Buf_5_Rot_270 327
+#define IDR_VP_PL2_444AVS16_Buf_5_Rot_90 328
+#define IDR_VP_PL2_444AVS16_Buf_Sep_Alpha_4 329
+#define IDR_VP_PL2_444AVS16_Buf_Sep_Alpha_4_Rot_180 330
+#define IDR_VP_PL2_444AVS16_Buf_Sep_Alpha_4_Rot_270 331
+#define IDR_VP_PL2_444AVS16_Buf_Sep_Alpha_4_Rot_90 332
+#define IDR_VP_PL2_444AVS16_Buf_Sep_Alpha_5 333
+#define IDR_VP_PL2_444AVS16_Buf_Sep_Alpha_5_Rot_180 334
+#define IDR_VP_PL2_444AVS16_Buf_Sep_Alpha_5_Rot_270 335
+#define IDR_VP_PL2_444AVS16_Buf_Sep_Alpha_5_Rot_90 336
+#define IDR_VP_PL2_444AVS16_ChromaSiting_Buf_0 337
+#define IDR_VP_PL2_444AVS16_ChromaSiting_Buf_1 338
+#define IDR_VP_PL2_444AVS16_ChromaSiting_Buf_2 339
+#define IDR_VP_PL2_444AVS16_ChromaSiting_Buf_3 340
+#define IDR_VP_PL2_444AVS16_ChromaSiting_Buf_4 341
+#define IDR_VP_PL2_444AVS16_ChromaSiting_Buf_5 342
+#define IDR_VP_PL2_444DScale16_Buf_0 343
+#define IDR_VP_PL2_444DScale16_Buf_0_Rot_180 344
+#define IDR_VP_PL2_444DScale16_Buf_0_Rot_270 345
+#define IDR_VP_PL2_444DScale16_Buf_0_Rot_90 346
+#define IDR_VP_PL2_444DScale16_Buf_1 347
+#define IDR_VP_PL2_444DScale16_Buf_1_Rot_180 348
+#define IDR_VP_PL2_444DScale16_Buf_1_Rot_270 349
+#define IDR_VP_PL2_444DScale16_Buf_1_Rot_90 350
+#define IDR_VP_PL2_444DScale16_Buf_2 351
+#define IDR_VP_PL2_444DScale16_Buf_2_Rot_180 352
+#define IDR_VP_PL2_444DScale16_Buf_2_Rot_270 353
+#define IDR_VP_PL2_444DScale16_Buf_2_Rot_90 354
+#define IDR_VP_PL2_444DScale16_Buf_3 355
+#define IDR_VP_PL2_444DScale16_Buf_3_Rot_180 356
+#define IDR_VP_PL2_444DScale16_Buf_3_Rot_270 357
+#define IDR_VP_PL2_444DScale16_Buf_3_Rot_90 358
+#define IDR_VP_PL2_444DScale16_Buf_4 359
+#define IDR_VP_PL2_444DScale16_Buf_4_Rot_180 360
+#define IDR_VP_PL2_444DScale16_Buf_4_Rot_270 361
+#define IDR_VP_PL2_444DScale16_Buf_4_Rot_90 362
+#define IDR_VP_PL2_444DScale16_Buf_5 363
+#define IDR_VP_PL2_444DScale16_Buf_5_Rot_180 364
+#define IDR_VP_PL2_444DScale16_Buf_5_Rot_270 365
+#define IDR_VP_PL2_444DScale16_Buf_5_Rot_90 366
+#define IDR_VP_PL2_444DScale16_Buf_Sep_Alpha_4 367
+#define IDR_VP_PL2_444DScale16_Buf_Sep_Alpha_5 368
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_0 369
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_0_Rot_180 370
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_0_Rot_270 371
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_0_Rot_90 372
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_1 373
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_1_Rot_180 374
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_1_Rot_270 375
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_1_Rot_90 376
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_2 377
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_2_Rot_180 378
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_2_Rot_270 379
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_2_Rot_90 380
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_3 381
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_3_Rot_180 382
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_3_Rot_270 383
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_3_Rot_90 384
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_4 385
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_4_Rot_180 386
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_4_Rot_270 387
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_4_Rot_90 388
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_5 389
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_5_Rot_180 390
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_5_Rot_270 391
+#define IDR_VP_PL2_444DScale16_ChromaSiting_Buf_5_Rot_90 392
+#define IDR_VP_PL2_444Scale16_Buf_0 393
+#define IDR_VP_PL2_444Scale16_Buf_0_Rot_180 394
+#define IDR_VP_PL2_444Scale16_Buf_0_Rot_270 395
+#define IDR_VP_PL2_444Scale16_Buf_0_Rot_90 396
+#define IDR_VP_PL2_444Scale16_Buf_1 397
+#define IDR_VP_PL2_444Scale16_Buf_1_Rot_180 398
+#define IDR_VP_PL2_444Scale16_Buf_1_Rot_270 399
+#define IDR_VP_PL2_444Scale16_Buf_1_Rot_90 400
+#define IDR_VP_PL2_444Scale16_Buf_2 401
+#define IDR_VP_PL2_444Scale16_Buf_2_Rot_180 402
+#define IDR_VP_PL2_444Scale16_Buf_2_Rot_270 403
+#define IDR_VP_PL2_444Scale16_Buf_2_Rot_90 404
+#define IDR_VP_PL2_444Scale16_Buf_3 405
+#define IDR_VP_PL2_444Scale16_Buf_3_Rot_180 406
+#define IDR_VP_PL2_444Scale16_Buf_3_Rot_270 407
+#define IDR_VP_PL2_444Scale16_Buf_3_Rot_90 408
+#define IDR_VP_PL2_444Scale16_Buf_4 409
+#define IDR_VP_PL2_444Scale16_Buf_4_Rot_180 410
+#define IDR_VP_PL2_444Scale16_Buf_4_Rot_270 411
+#define IDR_VP_PL2_444Scale16_Buf_4_Rot_90 412
+#define IDR_VP_PL2_444Scale16_Buf_5 413
+#define IDR_VP_PL2_444Scale16_Buf_5_Rot_180 414
+#define IDR_VP_PL2_444Scale16_Buf_5_Rot_270 415
+#define IDR_VP_PL2_444Scale16_Buf_5_Rot_90 416
+#define IDR_VP_PL2_444Scale16_Buf_Sep_Alpha_4 417
+#define IDR_VP_PL2_444Scale16_Buf_Sep_Alpha_4_Rot_180 418
+#define IDR_VP_PL2_444Scale16_Buf_Sep_Alpha_4_Rot_270 419
+#define IDR_VP_PL2_444Scale16_Buf_Sep_Alpha_4_Rot_90 420
+#define IDR_VP_PL2_444Scale16_Buf_Sep_Alpha_5 421
+#define IDR_VP_PL2_444Scale16_Buf_Sep_Alpha_5_Rot_180 422
+#define IDR_VP_PL2_444Scale16_Buf_Sep_Alpha_5_Rot_270 423
+#define IDR_VP_PL2_444Scale16_Buf_Sep_Alpha_5_Rot_90 424
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_0 425
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_0_Rot_180 426
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_0_Rot_270 427
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_0_Rot_90 428
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_1 429
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_1_Rot_180 430
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_1_Rot_270 431
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_1_Rot_90 432
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_2 433
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_2_Rot_180 434
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_2_Rot_270 435
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_2_Rot_90 436
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_3 437
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_3_Rot_180 438
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_3_Rot_270 439
+#define IDR_VP_PL2_444Scale16_Chromasiting_Buf_3_Rot_90 440
+#define IDR_VP_PL2_444iDScale16_Buf_0 441
+#define IDR_VP_PL2_444iDScale16_Buf_1 442
+#define IDR_VP_PL2_444iDScale16_Buf_2 443
+#define IDR_VP_PL2_444iDScale16_Buf_3 444
+#define IDR_VP_PL2_444iScale16_Buf_0 445
+#define IDR_VP_PL2_444iScale16_Buf_0_Rot_180 446
+#define IDR_VP_PL2_444iScale16_Buf_0_Rot_270 447
+#define IDR_VP_PL2_444iScale16_Buf_0_Rot_90 448
+#define IDR_VP_PL2_444iScale16_Buf_1 449
+#define IDR_VP_PL2_444iScale16_Buf_1_Rot_180 450
+#define IDR_VP_PL2_444iScale16_Buf_1_Rot_270 451
+#define IDR_VP_PL2_444iScale16_Buf_1_Rot_90 452
+#define IDR_VP_PL2_444iScale16_Buf_2 453
+#define IDR_VP_PL2_444iScale16_Buf_2_Rot_180 454
+#define IDR_VP_PL2_444iScale16_Buf_2_Rot_270 455
+#define IDR_VP_PL2_444iScale16_Buf_2_Rot_90 456
+#define IDR_VP_PL2_444iScale16_Buf_3 457
+#define IDR_VP_PL2_444iScale16_Buf_3_Rot_180 458
+#define IDR_VP_PL2_444iScale16_Buf_3_Rot_270 459
+#define IDR_VP_PL2_444iScale16_Buf_3_Rot_90 460
+#define IDR_VP_PL2_AVS_Mirror_H_L0 461
+#define IDR_VP_PL2_AVS_Mirror_H_L0_DualOutput 462
+#define IDR_VP_PL2_AVS_Mirror_V_L0 463
+#define IDR_VP_PL2_AVS_Rotate90_Mirror_H_L0 464
+#define IDR_VP_PL2_AVS_Rotate90_Mirror_V_L0 465
+#define IDR_VP_PL2_AVS_Rotate_L0_180 466
+#define IDR_VP_PL2_AVS_Rotate_L0_270 467
+#define IDR_VP_PL2_AVS_Rotate_L0_90 468
+#define IDR_VP_PL2_Copy 469
+#define IDR_VP_PL2_Scale_Mirror_H_L0 470
+#define IDR_VP_PL2_Scale_Mirror_H_L0_DualOutput 471
+#define IDR_VP_PL2_Scale_Mirror_V_L0 472
+#define IDR_VP_PL2_Scale_Rotate90_Mirror_H_L0 473
+#define IDR_VP_PL2_Scale_Rotate90_Mirror_V_L0 474
+#define IDR_VP_PL2_Scale_Rotate_L0_180 475
+#define IDR_VP_PL2_Scale_Rotate_L0_270 476
+#define IDR_VP_PL2_Scale_Rotate_L0_90 477
+#define IDR_VP_PL3_444AVS16_Buf_0 478
+#define IDR_VP_PL3_444AVS16_Buf_0_Rot_180 479
+#define IDR_VP_PL3_444AVS16_Buf_0_Rot_270 480
+#define IDR_VP_PL3_444AVS16_Buf_0_Rot_90 481
+#define IDR_VP_PL3_444AVS16_Buf_1 482
+#define IDR_VP_PL3_444AVS16_Buf_1_Rot_180 483
+#define IDR_VP_PL3_444AVS16_Buf_1_Rot_270 484
+#define IDR_VP_PL3_444AVS16_Buf_1_Rot_90 485
+#define IDR_VP_PL3_444AVS16_Buf_2 486
+#define IDR_VP_PL3_444AVS16_Buf_2_Rot_180 487
+#define IDR_VP_PL3_444AVS16_Buf_2_Rot_270 488
+#define IDR_VP_PL3_444AVS16_Buf_2_Rot_90 489
+#define IDR_VP_PL3_444AVS16_Buf_3 490
+#define IDR_VP_PL3_444AVS16_Buf_3_Rot_180 491
+#define IDR_VP_PL3_444AVS16_Buf_3_Rot_270 492
+#define IDR_VP_PL3_444AVS16_Buf_3_Rot_90 493
+#define IDR_VP_PL3_444AVS16_Buf_4 494
+#define IDR_VP_PL3_444AVS16_Buf_4_Rot_180 495
+#define IDR_VP_PL3_444AVS16_Buf_4_Rot_270 496
+#define IDR_VP_PL3_444AVS16_Buf_4_Rot_90 497
+#define IDR_VP_PL3_444AVS16_Buf_5 498
+#define IDR_VP_PL3_444AVS16_Buf_5_Rot_180 499
+#define IDR_VP_PL3_444AVS16_Buf_5_Rot_270 500
+#define IDR_VP_PL3_444AVS16_Buf_5_Rot_90 501
+#define IDR_VP_PL3_444DScale16_Buf_0 502
+#define IDR_VP_PL3_444DScale16_Buf_0_Rot_180 503
+#define IDR_VP_PL3_444DScale16_Buf_0_Rot_270 504
+#define IDR_VP_PL3_444DScale16_Buf_0_Rot_90 505
+#define IDR_VP_PL3_444DScale16_Buf_1 506
+#define IDR_VP_PL3_444DScale16_Buf_1_Rot_180 507
+#define IDR_VP_PL3_444DScale16_Buf_1_Rot_270 508
+#define IDR_VP_PL3_444DScale16_Buf_1_Rot_90 509
+#define IDR_VP_PL3_444DScale16_Buf_2 510
+#define IDR_VP_PL3_444DScale16_Buf_2_Rot_180 511
+#define IDR_VP_PL3_444DScale16_Buf_2_Rot_270 512
+#define IDR_VP_PL3_444DScale16_Buf_2_Rot_90 513
+#define IDR_VP_PL3_444DScale16_Buf_3 514
+#define IDR_VP_PL3_444DScale16_Buf_3_Rot_180 515
+#define IDR_VP_PL3_444DScale16_Buf_3_Rot_270 516
+#define IDR_VP_PL3_444DScale16_Buf_3_Rot_90 517
+#define IDR_VP_PL3_444DScale16_Buf_4 518
+#define IDR_VP_PL3_444DScale16_Buf_4_Rot_180 519
+#define IDR_VP_PL3_444DScale16_Buf_4_Rot_270 520
+#define IDR_VP_PL3_444DScale16_Buf_4_Rot_90 521
+#define IDR_VP_PL3_444DScale16_Buf_5 522
+#define IDR_VP_PL3_444DScale16_Buf_5_Rot_180 523
+#define IDR_VP_PL3_444DScale16_Buf_5_Rot_270 524
+#define IDR_VP_PL3_444DScale16_Buf_5_Rot_90 525
+#define IDR_VP_PL3_444Scale16_Buf_0 526
+#define IDR_VP_PL3_444Scale16_Buf_0_Rot_180 527
+#define IDR_VP_PL3_444Scale16_Buf_0_Rot_270 528
+#define IDR_VP_PL3_444Scale16_Buf_0_Rot_90 529
+#define IDR_VP_PL3_444Scale16_Buf_1 530
+#define IDR_VP_PL3_444Scale16_Buf_1_Rot_180 531
+#define IDR_VP_PL3_444Scale16_Buf_1_Rot_270 532
+#define IDR_VP_PL3_444Scale16_Buf_1_Rot_90 533
+#define IDR_VP_PL3_444Scale16_Buf_2 534
+#define IDR_VP_PL3_444Scale16_Buf_2_Rot_180 535
+#define IDR_VP_PL3_444Scale16_Buf_2_Rot_270 536
+#define IDR_VP_PL3_444Scale16_Buf_2_Rot_90 537
+#define IDR_VP_PL3_444Scale16_Buf_3 538
+#define IDR_VP_PL3_444Scale16_Buf_3_Rot_180 539
+#define IDR_VP_PL3_444Scale16_Buf_3_Rot_270 540
+#define IDR_VP_PL3_444Scale16_Buf_3_Rot_90 541
+#define IDR_VP_PL3_444Scale16_Buf_4 542
+#define IDR_VP_PL3_444Scale16_Buf_4_Rot_180 543
+#define IDR_VP_PL3_444Scale16_Buf_4_Rot_270 544
+#define IDR_VP_PL3_444Scale16_Buf_4_Rot_90 545
+#define IDR_VP_PL3_444Scale16_Buf_5 546
+#define IDR_VP_PL3_444Scale16_Buf_5_Rot_180 547
+#define IDR_VP_PL3_444Scale16_Buf_5_Rot_270 548
+#define IDR_VP_PL3_444Scale16_Buf_5_Rot_90 549
+#define IDR_VP_PL3_444iDScale16_Buf_0 550
+#define IDR_VP_PL3_444iDScale16_Buf_1 551
+#define IDR_VP_PL3_444iDScale16_Buf_2 552
+#define IDR_VP_PL3_444iDScale16_Buf_3 553
+#define IDR_VP_PL3_444iScale16_Buf_0 554
+#define IDR_VP_PL3_444iScale16_Buf_0_Rot_180 555
+#define IDR_VP_PL3_444iScale16_Buf_0_Rot_270 556
+#define IDR_VP_PL3_444iScale16_Buf_0_Rot_90 557
+#define IDR_VP_PL3_444iScale16_Buf_1 558
+#define IDR_VP_PL3_444iScale16_Buf_1_Rot_180 559
+#define IDR_VP_PL3_444iScale16_Buf_1_Rot_270 560
+#define IDR_VP_PL3_444iScale16_Buf_1_Rot_90 561
+#define IDR_VP_PL3_444iScale16_Buf_2 562
+#define IDR_VP_PL3_444iScale16_Buf_2_Rot_180 563
+#define IDR_VP_PL3_444iScale16_Buf_2_Rot_270 564
+#define IDR_VP_PL3_444iScale16_Buf_2_Rot_90 565
+#define IDR_VP_PL3_444iScale16_Buf_3 566
+#define IDR_VP_PL3_444iScale16_Buf_3_Rot_180 567
+#define IDR_VP_PL3_444iScale16_Buf_3_Rot_270 568
+#define IDR_VP_PL3_444iScale16_Buf_3_Rot_90 569
+#define IDR_VP_PL3_AVS_Rotate_L0_180 570
+#define IDR_VP_PL3_AVS_Rotate_L0_270 571
+#define IDR_VP_PL3_AVS_Rotate_L0_90 572
+#define IDR_VP_PL3_Scale_Rotate_L0_180 573
+#define IDR_VP_PL3_Scale_Rotate_L0_270 574
+#define IDR_VP_PL3_Scale_Rotate_L0_90 575
+#define IDR_VP_PLY_444DScale16_2f_Buf_0 576
+#define IDR_VP_PLY_444DScale16_2f_Buf_1 577
+#define IDR_VP_PLY_444DScale16_2f_Buf_2 578
+#define IDR_VP_PLY_444DScale16_2f_Buf_3 579
+#define IDR_VP_PLY_444DScale16_Buf_0 580
+#define IDR_VP_PLY_444DScale16_Buf_0_Rot_180 581
+#define IDR_VP_PLY_444DScale16_Buf_0_Rot_270 582
+#define IDR_VP_PLY_444DScale16_Buf_0_Rot_90 583
+#define IDR_VP_PLY_444DScale16_Buf_1 584
+#define IDR_VP_PLY_444DScale16_Buf_1_Rot_180 585
+#define IDR_VP_PLY_444DScale16_Buf_1_Rot_270 586
+#define IDR_VP_PLY_444DScale16_Buf_1_Rot_90 587
+#define IDR_VP_PLY_444DScale16_Buf_2 588
+#define IDR_VP_PLY_444DScale16_Buf_2_Rot_180 589
+#define IDR_VP_PLY_444DScale16_Buf_2_Rot_270 590
+#define IDR_VP_PLY_444DScale16_Buf_2_Rot_90 591
+#define IDR_VP_PLY_444DScale16_Buf_3 592
+#define IDR_VP_PLY_444DScale16_Buf_3_Rot_180 593
+#define IDR_VP_PLY_444DScale16_Buf_3_Rot_270 594
+#define IDR_VP_PLY_444DScale16_Buf_3_Rot_90 595
+#define IDR_VP_PartBlend_444_16 596
+#define IDR_VP_Prepare_LumaKey_SampleUnorm 597
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4 598
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_mirror_h 599
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_mirror_v 600
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_rot_180 601
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_rot_270 602
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_rot_90 603
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_rot_90_mirror_h 604
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_rot_90_mirror_v 605
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_1_8th 606
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_mirror_h 607
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_mirror_v 608
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_rot_180 609
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_rot_270 610
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_rot_90 611
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_rot_90_mirror_h 612
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_rot_90_mirror_v 613
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio 614
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_mirror_h 615
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_mirror_v 616
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_rot_180 617
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_rot_270 618
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_rot_90 619
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_rot_90_mirror_h 620
+#define IDR_VP_R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_rot_90_mirror_v 621
+#define IDR_VP_R8G8B8A8_DP_DownScaling_8x8 622
+#define IDR_VP_R8G8B8A8_DP_DownScaling_8x8_mirror_h 623
+#define IDR_VP_R8G8B8A8_DP_DownScaling_8x8_mirror_v 624
+#define IDR_VP_R8G8B8A8_DP_DownScaling_8x8_rot_180 625
+#define IDR_VP_R8G8B8A8_DP_DownScaling_8x8_rot_270 626
+#define IDR_VP_R8G8B8A8_DP_DownScaling_8x8_rot_90 627
+#define IDR_VP_R8G8B8A8_DP_DownScaling_8x8_rot_90_mirror_h 628
+#define IDR_VP_R8G8B8A8_DP_DownScaling_8x8_rot_90_mirror_v 629
+#define IDR_VP_R8G8B8A8_DP_UpScaling_16x16 630
+#define IDR_VP_R8G8B8A8_DP_UpScaling_16x16_mirror_h 631
+#define IDR_VP_R8G8B8A8_DP_UpScaling_16x16_mirror_v 632
+#define IDR_VP_R8G8B8A8_DP_UpScaling_16x16_rot_180 633
+#define IDR_VP_R8G8B8A8_DP_UpScaling_16x16_rot_270 634
+#define IDR_VP_R8G8B8A8_DP_UpScaling_16x16_rot_90 635
+#define IDR_VP_R8G8B8A8_DP_UpScaling_16x16_rot_90_mirror_h 636
+#define IDR_VP_R8G8B8A8_DP_UpScaling_16x16_rot_90_mirror_v 637
+#define IDR_VP_RGB2sRGB 638
+#define IDR_VP_RGBP_DP_DownScaling_8x8 639
+#define IDR_VP_RGBP_DP_UpScaling_16x16 640
+#define IDR_VP_Rotate_90_Mirror_AVS_H_L0 641
+#define IDR_VP_Rotate_90_Mirror_AVS_V_L0 642
+#define IDR_VP_Rotate_90_Mirror_H_scale_L0 643
+#define IDR_VP_Rotate_90_Mirror_V_scale_L0 644
+#define IDR_VP_Rotate_AVS_L0_180 645
+#define IDR_VP_Rotate_AVS_L0_270 646
+#define IDR_VP_Rotate_AVS_L0_90 647
+#define IDR_VP_Rotate_Scale_L0_180 648
+#define IDR_VP_Rotate_Scale_L0_270 649
+#define IDR_VP_Rotate_Scale_L0_90 650
+#define IDR_VP_SIP_Debug 651
+#define IDR_VP_Save_444AVS16_ARGB 652
+#define IDR_VP_Save_444AVS16_ARGB_64Byte 653
+#define IDR_VP_Save_444AVS16_NV12 654
+#define IDR_VP_Save_444AVS16_NV21 655
+#define IDR_VP_Save_444AVS16_PA 656
+#define IDR_VP_Save_444AVS16_PL3 657
+#define IDR_VP_Save_444AVS16_R10G10B10 658
+#define IDR_VP_Save_444AVS16_R10G10B10A2 659
+#define IDR_VP_Save_444AVS16_R10G10B10X2 660
+#define IDR_VP_Save_444AVS16_RGB 661
+#define IDR_VP_Save_444AVS16_RGB16 662
+#define IDR_VP_Save_444AVS16_RGB_64Byte 663
+#define IDR_VP_Save_444AVS16_SrcAYUV 664
+#define IDR_VP_Save_444AVS16_XRGB 665
+#define IDR_VP_Save_444AVS16_XRGB_64Byte 666
+#define IDR_VP_Save_444Scale16_ARGB 667
+#define IDR_VP_Save_444Scale16_ARGB_64Byte 668
+#define IDR_VP_Save_444Scale16_Dither_NV12 669
+#define IDR_VP_Save_444Scale16_Dither_NV21 670
+#define IDR_VP_Save_444Scale16_Dither_PA 671
+#define IDR_VP_Save_444Scale16_Dither_PA_32X16 672
+#define IDR_VP_Save_444Scale16_Dither_PL3 673
+#define IDR_VP_Save_444Scale16_Dither_RGB 674
+#define IDR_VP_Save_444Scale16_Dither_RGB16 675
+#define IDR_VP_Save_444Scale16_Dither_RGB_64Byte 676
+#define IDR_VP_Save_444Scale16_Dither_VUYA 677
+#define IDR_VP_Save_444Scale16_Dither_XRGB 678
+#define IDR_VP_Save_444Scale16_Dither_XRGB_64Byte 679
+#define IDR_VP_Save_444Scale16_NV12 680
+#define IDR_VP_Save_444Scale16_NV21 681
+#define IDR_VP_Save_444Scale16_P010 682
+#define IDR_VP_Save_444Scale16_P016 683
+#define IDR_VP_Save_444Scale16_PA 684
+#define IDR_VP_Save_444Scale16_PA_32X16 685
+#define IDR_VP_Save_444Scale16_PL3 686
+#define IDR_VP_Save_444Scale16_PLY 687
+#define IDR_VP_Save_444Scale16_R10G10B10 688
+#define IDR_VP_Save_444Scale16_R10G10B10A2 689
+#define IDR_VP_Save_444Scale16_R10G10B10X2 690
+#define IDR_VP_Save_444Scale16_R10G10B10XR 691
+#define IDR_VP_Save_444Scale16_R10G10B10XRA2 692
+#define IDR_VP_Save_444Scale16_R10G10B10XRX2 693
+#define IDR_VP_Save_444Scale16_RGB 694
+#define IDR_VP_Save_444Scale16_RGB16 695
+#define IDR_VP_Save_444Scale16_RGBP 696
+#define IDR_VP_Save_444Scale16_RGB_64Byte 697
+#define IDR_VP_Save_444Scale16_SrcVUYA 698
+#define IDR_VP_Save_444Scale16_SrcY416 699
+#define IDR_VP_Save_444Scale16_VUYA 700
+#define IDR_VP_Save_444Scale16_XRGB 701
+#define IDR_VP_Save_444Scale16_XRGB_64Byte 702
+#define IDR_VP_Save_444Scale16_Y210 703
+#define IDR_VP_Save_444Scale16_Y216 704
+#define IDR_VP_Save_444Scale16_Y410 705
+#define IDR_VP_Save_444Scale16_Y416 706
+#define IDR_VP_Save_ARGB_16x16 707
+#define IDR_VP_Save_ARGB_4x4 708
+#define IDR_VP_Save_ARGB_8x8 709
+#define IDR_VP_Save_NV12_16x16 710
+#define IDR_VP_Save_NV12_4x4 711
+#define IDR_VP_Save_NV12_8x8 712
+#define IDR_VP_Save_RGBP_16x16 713
+#define IDR_VP_Save_RGBP_4x4 714
+#define IDR_VP_Save_RGBP_8x8 715
+#define IDR_VP_Secure_Block_Copy 716
+#define IDR_VP_Set_Buf0_Buf4 717
+#define IDR_VP_Set_Buf1_Buf5 718
+#define IDR_VP_Set_Buf2_Buf4 719
+#define IDR_VP_Set_Buf3_Buf5 720
+#define IDR_VP_Set_CSC_Src_Buf0 721
+#define IDR_VP_Set_CSC_Src_Buf1 722
+#define IDR_VP_Set_CSC_Src_Buf2 723
+#define IDR_VP_Set_CSC_Src_Buf3 724
+#define IDR_VP_Set_CSC_Src_Buf4 725
+#define IDR_VP_Set_CSC_Src_Buf5 726
+#define IDR_VP_Set_CURBE_CSC_Coeff 727
+#define IDR_VP_Set_ColorE_Src_Buf0 728
+#define IDR_VP_Set_ColorE_Src_Buf1 729
+#define IDR_VP_Set_ColorE_Src_Buf2 730
+#define IDR_VP_Set_ColorE_Src_Buf3 731
+#define IDR_VP_Set_Dest_Surf_Indexes_Primary 732
+#define IDR_VP_Set_Dest_Surf_Indexes_Secondary 733
+#define IDR_VP_Set_GammaC_Src_Buf0 734
+#define IDR_VP_Set_GammaC_Src_Buf1 735
+#define IDR_VP_Set_GammaC_Src_Buf2 736
+#define IDR_VP_Set_GammaC_Src_Buf3 737
+#define IDR_VP_Set_Layer_0 738
+#define IDR_VP_Set_Layer_1 739
+#define IDR_VP_Set_Layer_1_AVS 740
+#define IDR_VP_Set_Layer_2 741
+#define IDR_VP_Set_Layer_3 742
+#define IDR_VP_Set_Layer_4 743
+#define IDR_VP_Set_Layer_5 744
+#define IDR_VP_Set_Layer_6 745
+#define IDR_VP_Set_Layer_7 746
+#define IDR_VP_Set_Patched_CSC_Coeff 747
+#define IDR_VP_Set_Scale_Buf_0123_Colorfill 748
+#define IDR_VP_Set_Sec_Half_Buf45 749
+#define IDR_VP_Shuffle_444AVS16_Buf_0 750
+#define IDR_VP_Shuffle_444AVS16_Buf_1 751
+#define IDR_VP_Shuffle_444AVS16_Buf_2 752
+#define IDR_VP_Shuffle_444AVS16_Buf_3 753
+#define IDR_VP_Shuffle_444AVS16_Buf_4 754
+#define IDR_VP_Shuffle_444AVS16_Buf_5 755
+#define IDR_VP_SrcBlend_444_16 756
+#define IDR_VP_SrcBlend_4bits_444_16 757
+#define IDR_VP_UpdateDNState 758
+#define IDR_VP_VP_Setup 759
+#define IDR_VP_VP_Setup_MediaWalker 760
+#define IDR_VP_VP_Setup_MediaWalker_32X16_Design 761
+#define IDR_VP_VP_Setup_MediaWalker_32x32_Color 762
+#define IDR_VP_XOR_Composite_444_16 763
+#define IDR_VP_XOR_Mono_Composite_444_16 764
+#define IDR_VP_Y210_444DScale16_Buf_0 765
+#define IDR_VP_Y210_444DScale16_Buf_0_Rot_180 766
+#define IDR_VP_Y210_444DScale16_Buf_0_Rot_270 767
+#define IDR_VP_Y210_444DScale16_Buf_0_Rot_90 768
+#define IDR_VP_Y210_444DScale16_Buf_1 769
+#define IDR_VP_Y210_444DScale16_Buf_1_Rot_180 770
+#define IDR_VP_Y210_444DScale16_Buf_1_Rot_270 771
+#define IDR_VP_Y210_444DScale16_Buf_1_Rot_90 772
+#define IDR_VP_Y210_444DScale16_Buf_2 773
+#define IDR_VP_Y210_444DScale16_Buf_2_Rot_180 774
+#define IDR_VP_Y210_444DScale16_Buf_2_Rot_270 775
+#define IDR_VP_Y210_444DScale16_Buf_2_Rot_90 776
+#define IDR_VP_Y210_444DScale16_Buf_3 777
+#define IDR_VP_Y210_444DScale16_Buf_3_Rot_180 778
+#define IDR_VP_Y210_444DScale16_Buf_3_Rot_270 779
+#define IDR_VP_Y210_444DScale16_Buf_3_Rot_90 780
+#define IDR_VP_Y210_444DScale16_Buf_4 781
+#define IDR_VP_Y210_444DScale16_Buf_4_Rot_180 782
+#define IDR_VP_Y210_444DScale16_Buf_4_Rot_270 783
+#define IDR_VP_Y210_444DScale16_Buf_4_Rot_90 784
+#define IDR_VP_Y210_444DScale16_Buf_5 785
+#define IDR_VP_Y210_444DScale16_Buf_5_Rot_180 786
+#define IDR_VP_Y210_444DScale16_Buf_5_Rot_270 787
+#define IDR_VP_Y210_444DScale16_Buf_5_Rot_90 788
+#define IDR_VP_Y210_444Scale16_Buf_0 789
+#define IDR_VP_Y210_444Scale16_Buf_0_Rot_180 790
+#define IDR_VP_Y210_444Scale16_Buf_0_Rot_270 791
+#define IDR_VP_Y210_444Scale16_Buf_0_Rot_90 792
+#define IDR_VP_Y210_444Scale16_Buf_1 793
+#define IDR_VP_Y210_444Scale16_Buf_1_Rot_180 794
+#define IDR_VP_Y210_444Scale16_Buf_1_Rot_270 795
+#define IDR_VP_Y210_444Scale16_Buf_1_Rot_90 796
+#define IDR_VP_Y210_444Scale16_Buf_2 797
+#define IDR_VP_Y210_444Scale16_Buf_2_Rot_180 798
+#define IDR_VP_Y210_444Scale16_Buf_2_Rot_270 799
+#define IDR_VP_Y210_444Scale16_Buf_2_Rot_90 800
+#define IDR_VP_Y210_444Scale16_Buf_3 801
+#define IDR_VP_Y210_444Scale16_Buf_3_Rot_180 802
+#define IDR_VP_Y210_444Scale16_Buf_3_Rot_270 803
+#define IDR_VP_Y210_444Scale16_Buf_3_Rot_90 804
+#define IDR_VP_Y210_444Scale16_Buf_4 805
+#define IDR_VP_Y210_444Scale16_Buf_4_Rot_180 806
+#define IDR_VP_Y210_444Scale16_Buf_4_Rot_270 807
+#define IDR_VP_Y210_444Scale16_Buf_4_Rot_90 808
+#define IDR_VP_Y210_444Scale16_Buf_5 809
+#define IDR_VP_Y210_444Scale16_Buf_5_Rot_180 810
+#define IDR_VP_Y210_444Scale16_Buf_5_Rot_270 811
+#define IDR_VP_Y210_444Scale16_Buf_5_Rot_90 812
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_0 813
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_0_Rot_180 814
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_0_Rot_270 815
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_0_Rot_90 816
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_1 817
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_1_Rot_180 818
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_1_Rot_270 819
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_1_Rot_90 820
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_2 821
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_2_Rot_180 822
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_2_Rot_270 823
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_2_Rot_90 824
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_3 825
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_3_Rot_180 826
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_3_Rot_270 827
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_3_Rot_90 828
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_4 829
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_4_Rot_180 830
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_4_Rot_270 831
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_4_Rot_90 832
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_5 833
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_5_Rot_180 834
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_5_Rot_270 835
+#define IDR_VP_Y210_444_AVS16_Y_Scale16_UV_Buf_5_Rot_90 836
+#define IDR_VP_Y410_444AVS16_Buf_0 837
+#define IDR_VP_Y410_444AVS16_Buf_0_Rot_180 838
+#define IDR_VP_Y410_444AVS16_Buf_0_Rot_270 839
+#define IDR_VP_Y410_444AVS16_Buf_0_Rot_90 840
+#define IDR_VP_Y410_444AVS16_Buf_1 841
+#define IDR_VP_Y410_444AVS16_Buf_1_Rot_180 842
+#define IDR_VP_Y410_444AVS16_Buf_1_Rot_270 843
+#define IDR_VP_Y410_444AVS16_Buf_1_Rot_90 844
+#define IDR_VP_Y410_444AVS16_Buf_2 845
+#define IDR_VP_Y410_444AVS16_Buf_2_Rot_180 846
+#define IDR_VP_Y410_444AVS16_Buf_2_Rot_270 847
+#define IDR_VP_Y410_444AVS16_Buf_2_Rot_90 848
+#define IDR_VP_Y410_444AVS16_Buf_3 849
+#define IDR_VP_Y410_444AVS16_Buf_3_Rot_180 850
+#define IDR_VP_Y410_444AVS16_Buf_3_Rot_270 851
+#define IDR_VP_Y410_444AVS16_Buf_3_Rot_90 852
+#define IDR_VP_Y410_444AVS16_Buf_4 853
+#define IDR_VP_Y410_444AVS16_Buf_4_Rot_180 854
+#define IDR_VP_Y410_444AVS16_Buf_4_Rot_270 855
+#define IDR_VP_Y410_444AVS16_Buf_4_Rot_90 856
+#define IDR_VP_Y410_444AVS16_Buf_5 857
+#define IDR_VP_Y410_444AVS16_Buf_5_Rot_180 858
+#define IDR_VP_Y410_444AVS16_Buf_5_Rot_270 859
+#define IDR_VP_Y410_444AVS16_Buf_5_Rot_90 860
+#define IDR_VP_Y410_444DScale16_Buf_0 861
+#define IDR_VP_Y410_444DScale16_Buf_0_Rot_180 862
+#define IDR_VP_Y410_444DScale16_Buf_0_Rot_270 863
+#define IDR_VP_Y410_444DScale16_Buf_0_Rot_90 864
+#define IDR_VP_Y410_444DScale16_Buf_1 865
+#define IDR_VP_Y410_444DScale16_Buf_1_Rot_180 866
+#define IDR_VP_Y410_444DScale16_Buf_1_Rot_270 867
+#define IDR_VP_Y410_444DScale16_Buf_1_Rot_90 868
+#define IDR_VP_Y410_444DScale16_Buf_2 869
+#define IDR_VP_Y410_444DScale16_Buf_2_Rot_180 870
+#define IDR_VP_Y410_444DScale16_Buf_2_Rot_270 871
+#define IDR_VP_Y410_444DScale16_Buf_2_Rot_90 872
+#define IDR_VP_Y410_444DScale16_Buf_3 873
+#define IDR_VP_Y410_444DScale16_Buf_3_Rot_180 874
+#define IDR_VP_Y410_444DScale16_Buf_3_Rot_270 875
+#define IDR_VP_Y410_444DScale16_Buf_3_Rot_90 876
+#define IDR_VP_Y410_444DScale16_Buf_4 877
+#define IDR_VP_Y410_444DScale16_Buf_4_Rot_180 878
+#define IDR_VP_Y410_444DScale16_Buf_4_Rot_270 879
+#define IDR_VP_Y410_444DScale16_Buf_4_Rot_90 880
+#define IDR_VP_Y410_444DScale16_Buf_5 881
+#define IDR_VP_Y410_444DScale16_Buf_5_Rot_180 882
+#define IDR_VP_Y410_444DScale16_Buf_5_Rot_270 883
+#define IDR_VP_Y410_444DScale16_Buf_5_Rot_90 884
+#define IDR_VP_Y410_444Scale16_Buf_0 885
+#define IDR_VP_Y410_444Scale16_Buf_0_Rot_180 886
+#define IDR_VP_Y410_444Scale16_Buf_0_Rot_270 887
+#define IDR_VP_Y410_444Scale16_Buf_0_Rot_90 888
+#define IDR_VP_Y410_444Scale16_Buf_1 889
+#define IDR_VP_Y410_444Scale16_Buf_1_Rot_180 890
+#define IDR_VP_Y410_444Scale16_Buf_1_Rot_270 891
+#define IDR_VP_Y410_444Scale16_Buf_1_Rot_90 892
+#define IDR_VP_Y410_444Scale16_Buf_2 893
+#define IDR_VP_Y410_444Scale16_Buf_2_Rot_180 894
+#define IDR_VP_Y410_444Scale16_Buf_2_Rot_270 895
+#define IDR_VP_Y410_444Scale16_Buf_2_Rot_90 896
+#define IDR_VP_Y410_444Scale16_Buf_3 897
+#define IDR_VP_Y410_444Scale16_Buf_3_Rot_180 898
+#define IDR_VP_Y410_444Scale16_Buf_3_Rot_270 899
+#define IDR_VP_Y410_444Scale16_Buf_3_Rot_90 900
+#define IDR_VP_Y410_444Scale16_Buf_4 901
+#define IDR_VP_Y410_444Scale16_Buf_4_Rot_180 902
+#define IDR_VP_Y410_444Scale16_Buf_4_Rot_270 903
+#define IDR_VP_Y410_444Scale16_Buf_4_Rot_90 904
+#define IDR_VP_Y410_444Scale16_Buf_5 905
+#define IDR_VP_Y410_444Scale16_Buf_5_Rot_180 906
+#define IDR_VP_Y410_444Scale16_Buf_5_Rot_270 907
+#define IDR_VP_Y410_444Scale16_Buf_5_Rot_90 908
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_0 909
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_0_Rot_180 910
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_0_Rot_270 911
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_0_Rot_90 912
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_1 913
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_1_Rot_180 914
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_1_Rot_270 915
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_1_Rot_90 916
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_2 917
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_2_Rot_180 918
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_2_Rot_270 919
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_2_Rot_90 920
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_3 921
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_3_Rot_180 922
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_3_Rot_270 923
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_3_Rot_90 924
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_4 925
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_4_Rot_180 926
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_4_Rot_270 927
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_4_Rot_90 928
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_5 929
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_5_Rot_180 930
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_5_Rot_270 931
+#define IDR_VP_YUY2_444Scale16_Chromasiting_Buf_5_Rot_90 932
+#define IDR_VP_camera_pipe_CalcParams 933
+#define IDR_VP_fast_avs_1_to_n 934
+#define IDR_VP_return 935
+#define IDR_VP_sampler_scaling 936
+#define IDR_VP_zzz_preproduction 937
+#define IDR_VP_zzz_preproduction_ALLPL2Copy_Gen 938
+#define IDR_VP_zzz_preproduction_HDR_mandatory_Gen 939
+#define IDR_VP_zzz_preproduction_HDR_per_frame_stat_Gen 940
+#define IDR_VP_zzz_preproduction_gcBltPS_32_To_128_Mirror_Gen 941
+#define IDR_VP_zzz_preproduction_gcBltPS_64_To_128_Mirror_Gen 942
+#define IDR_VP_zzz_preproduction_gcBltPS_Gen 943
+#define IDR_VP_zzz_preproduction_gcBlt_D11 944
+#define IDR_VP_zzz_preproduction_gcClearNoReplicatePS_Gen 945
+#define IDR_VP_zzz_preproduction_gcClearReplicatePS_Gen 946
+#define IDR_VP_zzz_preproduction_gcClear_NoReplicate_D11 947
+#define IDR_VP_zzz_preproduction_gcClear_Replicate_D11 948
+#define IDR_VP_zzz_preproduction_gcColorFillNoReplicatePS_Gen 949
+#define IDR_VP_zzz_preproduction_gcColorFillReplicatePS_Gen 950
+#define IDR_VP_zzz_preproduction_gcFastClearReplicatePS_Gen 951
+#define IDR_VP_zzz_preproduction_gcFastClear_Replicate_D11 952
+#define IDR_VP_zzz_preproduction_gcResourceCopy_D11 953
+#define IDR_VP_zzz_production 954
+#define IDR_VP_zzz_production_ALLPL2Copy_Gen 955
+#define IDR_VP_zzz_production_HDR_mandatory_Gen 956
+#define IDR_VP_zzz_production_HDR_per_frame_stat_Gen 957
+#define IDR_VP_zzz_production_gcBltPS_32_To_128_Mirror_Gen 958
+#define IDR_VP_zzz_production_gcBltPS_64_To_128_Mirror_Gen 959
+#define IDR_VP_zzz_production_gcBltPS_Gen 960
+#define IDR_VP_zzz_production_gcBlt_D11 961
+#define IDR_VP_zzz_production_gcClearNoReplicatePS_Gen 962
+#define IDR_VP_zzz_production_gcClearReplicatePS_Gen 963
+#define IDR_VP_zzz_production_gcClear_NoReplicate_D11 964
+#define IDR_VP_zzz_production_gcClear_Replicate_D11 965
+#define IDR_VP_zzz_production_gcColorFillNoReplicatePS_Gen 966
+#define IDR_VP_zzz_production_gcColorFillReplicatePS_Gen 967
+#define IDR_VP_zzz_production_gcFastClearReplicatePS_Gen 968
+#define IDR_VP_zzz_production_gcFastClear_Replicate_D11 969
+#define IDR_VP_zzz_production_gcResourceCopy_D11 970
+#define IDR_VP_TOTAL_NUM_KERNELS 971
+
+#if (_DEBUG || _RELEASE_INTERNAL)
+#define IDR_VP_KERNEL_NAMES   \
+    _T("1_1_16aligned"),\
+    _T("3DLUT"),\
+    _T("AlphaSrcBlendG"),\
+    _T("ApplyScaling"),\
+    _T("ByteCopy"),\
+    _T("ByteCopy_MediaWalker"),\
+    _T("CSC_16x16"),\
+    _T("CSC_444_16"),\
+    _T("CSC_4x4"),\
+    _T("CSC_8x8"),\
+    _T("CSC_Premultiplied_444_16"),\
+    _T("Call_AlphaSrcBlendG"),\
+    _T("Call_CSC"),\
+    _T("Call_CSC_Premultiplied"),\
+    _T("Call_ColorE"),\
+    _T("Call_Composite"),\
+    _T("Call_ConstBlend"),\
+    _T("Call_ConstSrcBlend"),\
+    _T("Call_GammaC"),\
+    _T("Call_Mirror_H_YUV"),\
+    _T("Call_Mirror_H_YUVA"),\
+    _T("Call_PartBlend"),\
+    _T("Call_SrcBlend"),\
+    _T("Call_SrcBlend_4bits"),\
+    _T("Call_XOR_Composite"),\
+    _T("Call_XOR_Mono_Composite"),\
+    _T("ColorE"),\
+    _T("Colorfill_444AVS16"),\
+    _T("Colorfill_444AVS16_ConstBlend"),\
+    _T("Colorfill_444AVS16_ConstSrcBlend"),\
+    _T("Colorfill_444AVS16_PartBlend"),\
+    _T("Colorfill_444AVS16_SrcBlend"),\
+    _T("Colorfill_444Scale16"),\
+    _T("Colorfill_444Scale16_ConstBlend"),\
+    _T("Colorfill_444Scale16_ConstSrcBlend"),\
+    _T("Colorfill_444Scale16_PartBlend"),\
+    _T("Colorfill_444Scale16_SrcBlend"),\
+    _T("Composite_444_16"),\
+    _T("Compute_Lumakey"),\
+    _T("Compute_Lumakey_Buf0123"),\
+    _T("ConstBlend_444_16"),\
+    _T("ConstSrcBlend_444_16"),\
+    _T("CopyKernel_1D_to_2D_NV12_genx"),\
+    _T("CopyKernel_1D_to_2D_RGBP_genx"),\
+    _T("CopyKernel_1D_to_2D_genx"),\
+    _T("CopyKernel_2D_to_1D_NV12_genx"),\
+    _T("CopyKernel_2D_to_1D_RGBP_genx"),\
+    _T("CopyKernel_2D_to_1D_genx"),\
+    _T("CopyKernel_2D_to_2D_NV12_genx"),\
+    _T("CopyKernel_2D_to_2D_RGBP_genx"),\
+    _T("CopyKernel_2D_to_2D_genx"),\
+    _T("DP_FC_Setup_Walker_16x16"),\
+    _T("DP_FC_Setup_Walker_4x4"),\
+    _T("DP_FC_Setup_Walker_8x8"),\
+    _T("EOT"),\
+    _T("FMD_Summation"),\
+    _T("FRC_Clean_Map"),\
+    _T("FRC_GMV_Detection"),\
+    _T("FRC_GMV_Sanity_Check"),\
+    _T("FRC_GradUV"),\
+    _T("FRC_GradY"),\
+    _T("FRC_MC"),\
+    _T("FRC_ME_Level1"),\
+    _T("FRC_ME_Level2"),\
+    _T("FRC_ME_Level3"),\
+    _T("FRC_MV_Level1"),\
+    _T("FRC_MV_Level2"),\
+    _T("FRC_MV_Level3"),\
+    _T("FRC_PS"),\
+    _T("FRC_SPD_Map"),\
+    _T("FRC_TempDiff"),\
+    _T("FRC_TempDiff_HD"),\
+    _T("FRC_WSD"),\
+    _T("GammaC"),\
+    _T("GeoCorrection"),\
+    _T("HDR_mandatory"),\
+    _T("HDR_per_frame_stat"),\
+    _T("HDR_preprocess"),\
+    _T("IS_DS"),\
+    _T("IS_FW"),\
+    _T("IS_GMC"),\
+    _T("IS_ME"),\
+    _T("Interlace_420_16_Buf_0"),\
+    _T("Interlace_420_16_Buf_1"),\
+    _T("Interlace_420_16_Buf_2"),\
+    _T("Interlace_420_16_Buf_3"),\
+    _T("Interlace_444AVS16_Buf_0"),\
+    _T("Interlace_444AVS16_Buf_1"),\
+    _T("Interlace_444AVS16_Buf_2"),\
+    _T("Interlace_444AVS16_Buf_3"),\
+    _T("Interlace_444_16_Buf_0"),\
+    _T("Interlace_444_16_Buf_1"),\
+    _T("Interlace_444_16_Buf_2"),\
+    _T("Interlace_444_16_Buf_3"),\
+    _T("LACE_HIST_SUM"),\
+    _T("LACE_LUT"),\
+    _T("LACE_PWLF"),\
+    _T("LACE_STD"),\
+    _T("LinkFile"),\
+    _T("Mirror_AVS_H_L0"),\
+    _T("Mirror_AVS_V_L0"),\
+    _T("Mirror_H_YUV"),\
+    _T("Mirror_H_YUVA"),\
+    _T("Mirror_scale_H_L0"),\
+    _T("Mirror_scale_V_L0"),\
+    _T("NV12_DP_DownScaling_4x4"),\
+    _T("NV12_DP_DownScaling_4x4_mirror_h"),\
+    _T("NV12_DP_DownScaling_4x4_mirror_v"),\
+    _T("NV12_DP_DownScaling_4x4_rot_180"),\
+    _T("NV12_DP_DownScaling_4x4_rot_270"),\
+    _T("NV12_DP_DownScaling_4x4_rot_90"),\
+    _T("NV12_DP_DownScaling_4x4_rot_90_mirror_h"),\
+    _T("NV12_DP_DownScaling_4x4_rot_90_mirror_v"),\
+    _T("NV12_DP_DownScaling_4x4_scale_1_8th"),\
+    _T("NV12_DP_DownScaling_4x4_scale_1_8th_mirror_h"),\
+    _T("NV12_DP_DownScaling_4x4_scale_1_8th_mirror_v"),\
+    _T("NV12_DP_DownScaling_4x4_scale_1_8th_rot_180"),\
+    _T("NV12_DP_DownScaling_4x4_scale_1_8th_rot_270"),\
+    _T("NV12_DP_DownScaling_4x4_scale_1_8th_rot_90"),\
+    _T("NV12_DP_DownScaling_4x4_scale_1_8th_rot_90_mirror_h"),\
+    _T("NV12_DP_DownScaling_4x4_scale_1_8th_rot_90_mirror_v"),\
+    _T("NV12_DP_DownScaling_4x4_scale_to_any_ratio"),\
+    _T("NV12_DP_DownScaling_4x4_scale_to_any_ratio_mirror_h"),\
+    _T("NV12_DP_DownScaling_4x4_scale_to_any_ratio_mirror_v"),\
+    _T("NV12_DP_DownScaling_4x4_scale_to_any_ratio_rot_180"),\
+    _T("NV12_DP_DownScaling_4x4_scale_to_any_ratio_rot_270"),\
+    _T("NV12_DP_DownScaling_4x4_scale_to_any_ratio_rot_90"),\
+    _T("NV12_DP_DownScaling_4x4_scale_to_any_ratio_rot_90_mirror_h"),\
+    _T("NV12_DP_DownScaling_4x4_scale_to_any_ratio_rot_90_mirror_v"),\
+    _T("NV12_DP_DownScaling_8x8"),\
+    _T("NV12_DP_DownScaling_8x8_mirror_h"),\
+    _T("NV12_DP_DownScaling_8x8_mirror_v"),\
+    _T("NV12_DP_DownScaling_8x8_rot_180"),\
+    _T("NV12_DP_DownScaling_8x8_rot_270"),\
+    _T("NV12_DP_DownScaling_8x8_rot_90"),\
+    _T("NV12_DP_DownScaling_8x8_rot_90_mirror_h"),\
+    _T("NV12_DP_DownScaling_8x8_rot_90_mirror_v"),\
+    _T("NV12_DP_UpScaling_16x16"),\
+    _T("NV12_DP_UpScaling_16x16_mirror_h"),\
+    _T("NV12_DP_UpScaling_16x16_mirror_v"),\
+    _T("NV12_DP_UpScaling_16x16_rot_180"),\
+    _T("NV12_DP_UpScaling_16x16_rot_270"),\
+    _T("NV12_DP_UpScaling_16x16_rot_90"),\
+    _T("NV12_DP_UpScaling_16x16_rot_90_mirror_h"),\
+    _T("NV12_DP_UpScaling_16x16_rot_90_mirror_v"),\
+    _T("NV12_DP_rotation_avg"),\
+    _T("NV12_DP_rotation_nv12"),\
+    _T("NV12_DP_rotation_rep"),\
+    _T("P010_444Dscale16_Buf_0"),\
+    _T("P010_444Dscale16_Buf_0_Rot_180"),\
+    _T("P010_444Dscale16_Buf_0_Rot_270"),\
+    _T("P010_444Dscale16_Buf_0_Rot_90"),\
+    _T("P010_444Dscale16_Buf_1"),\
+    _T("P010_444Dscale16_Buf_1_Rot_180"),\
+    _T("P010_444Dscale16_Buf_1_Rot_270"),\
+    _T("P010_444Dscale16_Buf_1_Rot_90"),\
+    _T("P010_444Dscale16_Buf_2"),\
+    _T("P010_444Dscale16_Buf_2_Rot_180"),\
+    _T("P010_444Dscale16_Buf_2_Rot_270"),\
+    _T("P010_444Dscale16_Buf_2_Rot_90"),\
+    _T("P010_444Dscale16_Buf_3"),\
+    _T("P010_444Dscale16_Buf_3_Rot_180"),\
+    _T("P010_444Dscale16_Buf_3_Rot_270"),\
+    _T("P010_444Dscale16_Buf_3_Rot_90"),\
+    _T("PA_444AVS16_Buf_0"),\
+    _T("PA_444AVS16_Buf_0_Rot_180"),\
+    _T("PA_444AVS16_Buf_0_Rot_270"),\
+    _T("PA_444AVS16_Buf_0_Rot_90"),\
+    _T("PA_444AVS16_Buf_1"),\
+    _T("PA_444AVS16_Buf_1_Rot_180"),\
+    _T("PA_444AVS16_Buf_1_Rot_270"),\
+    _T("PA_444AVS16_Buf_1_Rot_90"),\
+    _T("PA_444AVS16_Buf_2"),\
+    _T("PA_444AVS16_Buf_2_Rot_180"),\
+    _T("PA_444AVS16_Buf_2_Rot_270"),\
+    _T("PA_444AVS16_Buf_2_Rot_90"),\
+    _T("PA_444AVS16_Buf_3"),\
+    _T("PA_444AVS16_Buf_3_Rot_180"),\
+    _T("PA_444AVS16_Buf_3_Rot_270"),\
+    _T("PA_444AVS16_Buf_3_Rot_90"),\
+    _T("PA_444AVS16_Buf_4"),\
+    _T("PA_444AVS16_Buf_4_Rot_180"),\
+    _T("PA_444AVS16_Buf_4_Rot_270"),\
+    _T("PA_444AVS16_Buf_4_Rot_90"),\
+    _T("PA_444AVS16_Buf_5"),\
+    _T("PA_444AVS16_Buf_5_Rot_180"),\
+    _T("PA_444AVS16_Buf_5_Rot_270"),\
+    _T("PA_444AVS16_Buf_5_Rot_90"),\
+    _T("PA_444AVS16_HDC_DW_PLANAR_420_8_Buf_0"),\
+    _T("PA_444AVS16_HDC_DW_PLANAR_420_8_Buf_1"),\
+    _T("PA_444AVS16_HDC_DW_PLANAR_420_8_Buf_2"),\
+    _T("PA_444AVS16_HDC_DW_PLANAR_420_8_Buf_3"),\
+    _T("PA_444AVS16_HDC_DW_Y8_UNORM_Buf_0"),\
+    _T("PA_444AVS16_HDC_DW_Y8_UNORM_Buf_1"),\
+    _T("PA_444AVS16_HDC_DW_Y8_UNORM_Buf_2"),\
+    _T("PA_444AVS16_HDC_DW_Y8_UNORM_Buf_3"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_NORMAL_Buf_0"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_NORMAL_Buf_1"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_NORMAL_Buf_2"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_NORMAL_Buf_3"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPUVY_Buf_0"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPUVY_Buf_1"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPUVY_Buf_2"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPUVY_Buf_3"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPUV_Buf_0"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPUV_Buf_1"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPUV_Buf_2"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPUV_Buf_3"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPY_Buf_0"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPY_Buf_1"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPY_Buf_2"),\
+    _T("PA_444AVS16_HDC_DW_YCRCB_SWAPY_Buf_3"),\
+    _T("PA_444DScale16_Buf_0"),\
+    _T("PA_444DScale16_Buf_0_Rot_180"),\
+    _T("PA_444DScale16_Buf_0_Rot_270"),\
+    _T("PA_444DScale16_Buf_0_Rot_90"),\
+    _T("PA_444DScale16_Buf_1"),\
+    _T("PA_444DScale16_Buf_1_Rot_180"),\
+    _T("PA_444DScale16_Buf_1_Rot_270"),\
+    _T("PA_444DScale16_Buf_1_Rot_90"),\
+    _T("PA_444DScale16_Buf_2"),\
+    _T("PA_444DScale16_Buf_2_Rot_180"),\
+    _T("PA_444DScale16_Buf_2_Rot_270"),\
+    _T("PA_444DScale16_Buf_2_Rot_90"),\
+    _T("PA_444DScale16_Buf_3"),\
+    _T("PA_444DScale16_Buf_3_Rot_180"),\
+    _T("PA_444DScale16_Buf_3_Rot_270"),\
+    _T("PA_444DScale16_Buf_3_Rot_90"),\
+    _T("PA_444DScale16_Buf_4"),\
+    _T("PA_444DScale16_Buf_4_Rot_180"),\
+    _T("PA_444DScale16_Buf_4_Rot_270"),\
+    _T("PA_444DScale16_Buf_4_Rot_90"),\
+    _T("PA_444DScale16_Buf_5"),\
+    _T("PA_444DScale16_Buf_5_Rot_180"),\
+    _T("PA_444DScale16_Buf_5_Rot_270"),\
+    _T("PA_444DScale16_Buf_5_Rot_90"),\
+    _T("PA_444Scale16_Buf_0"),\
+    _T("PA_444Scale16_Buf_0_Rot_180"),\
+    _T("PA_444Scale16_Buf_0_Rot_270"),\
+    _T("PA_444Scale16_Buf_0_Rot_90"),\
+    _T("PA_444Scale16_Buf_1"),\
+    _T("PA_444Scale16_Buf_1_Rot_180"),\
+    _T("PA_444Scale16_Buf_1_Rot_270"),\
+    _T("PA_444Scale16_Buf_1_Rot_90"),\
+    _T("PA_444Scale16_Buf_2"),\
+    _T("PA_444Scale16_Buf_2_Rot_180"),\
+    _T("PA_444Scale16_Buf_2_Rot_270"),\
+    _T("PA_444Scale16_Buf_2_Rot_90"),\
+    _T("PA_444Scale16_Buf_3"),\
+    _T("PA_444Scale16_Buf_3_Rot_180"),\
+    _T("PA_444Scale16_Buf_3_Rot_270"),\
+    _T("PA_444Scale16_Buf_3_Rot_90"),\
+    _T("PA_444Scale16_Buf_4"),\
+    _T("PA_444Scale16_Buf_4_Rot_180"),\
+    _T("PA_444Scale16_Buf_4_Rot_270"),\
+    _T("PA_444Scale16_Buf_4_Rot_90"),\
+    _T("PA_444Scale16_Buf_5"),\
+    _T("PA_444Scale16_Buf_5_Rot_180"),\
+    _T("PA_444Scale16_Buf_5_Rot_270"),\
+    _T("PA_444Scale16_Buf_5_Rot_90"),\
+    _T("PA_444iAVS16_Buf_0"),\
+    _T("PA_444iAVS16_Buf_1"),\
+    _T("PA_444iAVS16_Buf_2"),\
+    _T("PA_444iAVS16_Buf_3"),\
+    _T("PA_444iDScale16_Buf_0"),\
+    _T("PA_444iDScale16_Buf_1"),\
+    _T("PA_444iDScale16_Buf_2"),\
+    _T("PA_444iDScale16_Buf_3"),\
+    _T("PA_444iScale16_Buf_0"),\
+    _T("PA_444iScale16_Buf_0_Rot_180"),\
+    _T("PA_444iScale16_Buf_0_Rot_270"),\
+    _T("PA_444iScale16_Buf_0_Rot_90"),\
+    _T("PA_444iScale16_Buf_1"),\
+    _T("PA_444iScale16_Buf_1_Rot_180"),\
+    _T("PA_444iScale16_Buf_1_Rot_270"),\
+    _T("PA_444iScale16_Buf_1_Rot_90"),\
+    _T("PA_444iScale16_Buf_2"),\
+    _T("PA_444iScale16_Buf_2_Rot_180"),\
+    _T("PA_444iScale16_Buf_2_Rot_270"),\
+    _T("PA_444iScale16_Buf_2_Rot_90"),\
+    _T("PA_444iScale16_Buf_3"),\
+    _T("PA_444iScale16_Buf_3_Rot_180"),\
+    _T("PA_444iScale16_Buf_3_Rot_270"),\
+    _T("PA_444iScale16_Buf_3_Rot_90"),\
+    _T("PA_AVS_Mirror_H_L0"),\
+    _T("PA_AVS_Mirror_V_L0"),\
+    _T("PA_AVS_Rotate_90_Mirror_H_L0"),\
+    _T("PA_AVS_Rotate_90_Mirror_V_L0"),\
+    _T("PA_AVS_Rotate_L0_180"),\
+    _T("PA_AVS_Rotate_L0_270"),\
+    _T("PA_AVS_Rotate_L0_90"),\
+    _T("PA_Copy"),\
+    _T("PA_Scale_Mirror_H_L0"),\
+    _T("PA_Scale_Mirror_V_L0"),\
+    _T("PA_Scale_Rotate90_Mirror_H_L0"),\
+    _T("PA_Scale_Rotate90_Mirror_V_L0"),\
+    _T("PA_Scale_Rotate_L0_180"),\
+    _T("PA_Scale_Rotate_L0_270"),\
+    _T("PA_Scale_Rotate_L0_90"),\
+    _T("PL2_422AVS16_ChromaSiting_Buf_0"),\
+    _T("PL2_422AVS16_ChromaSiting_Buf_1"),\
+    _T("PL2_422AVS16_ChromaSiting_Buf_2"),\
+    _T("PL2_422AVS16_ChromaSiting_Buf_3"),\
+    _T("PL2_422AVS16_ChromaSiting_Buf_4"),\
+    _T("PL2_422AVS16_ChromaSiting_Buf_5"),\
+    _T("PL2_444AVS16_Buf_0"),\
+    _T("PL2_444AVS16_Buf_0_Rot_180"),\
+    _T("PL2_444AVS16_Buf_0_Rot_270"),\
+    _T("PL2_444AVS16_Buf_0_Rot_90"),\
+    _T("PL2_444AVS16_Buf_1"),\
+    _T("PL2_444AVS16_Buf_1_Rot_180"),\
+    _T("PL2_444AVS16_Buf_1_Rot_270"),\
+    _T("PL2_444AVS16_Buf_1_Rot_90"),\
+    _T("PL2_444AVS16_Buf_2"),\
+    _T("PL2_444AVS16_Buf_2_Rot_180"),\
+    _T("PL2_444AVS16_Buf_2_Rot_270"),\
+    _T("PL2_444AVS16_Buf_2_Rot_90"),\
+    _T("PL2_444AVS16_Buf_3"),\
+    _T("PL2_444AVS16_Buf_3_Rot_180"),\
+    _T("PL2_444AVS16_Buf_3_Rot_270"),\
+    _T("PL2_444AVS16_Buf_3_Rot_90"),\
+    _T("PL2_444AVS16_Buf_4"),\
+    _T("PL2_444AVS16_Buf_4_Rot_180"),\
+    _T("PL2_444AVS16_Buf_4_Rot_270"),\
+    _T("PL2_444AVS16_Buf_4_Rot_90"),\
+    _T("PL2_444AVS16_Buf_5"),\
+    _T("PL2_444AVS16_Buf_5_Rot_180"),\
+    _T("PL2_444AVS16_Buf_5_Rot_270"),\
+    _T("PL2_444AVS16_Buf_5_Rot_90"),\
+    _T("PL2_444AVS16_Buf_Sep_Alpha_4"),\
+    _T("PL2_444AVS16_Buf_Sep_Alpha_4_Rot_180"),\
+    _T("PL2_444AVS16_Buf_Sep_Alpha_4_Rot_270"),\
+    _T("PL2_444AVS16_Buf_Sep_Alpha_4_Rot_90"),\
+    _T("PL2_444AVS16_Buf_Sep_Alpha_5"),\
+    _T("PL2_444AVS16_Buf_Sep_Alpha_5_Rot_180"),\
+    _T("PL2_444AVS16_Buf_Sep_Alpha_5_Rot_270"),\
+    _T("PL2_444AVS16_Buf_Sep_Alpha_5_Rot_90"),\
+    _T("PL2_444AVS16_ChromaSiting_Buf_0"),\
+    _T("PL2_444AVS16_ChromaSiting_Buf_1"),\
+    _T("PL2_444AVS16_ChromaSiting_Buf_2"),\
+    _T("PL2_444AVS16_ChromaSiting_Buf_3"),\
+    _T("PL2_444AVS16_ChromaSiting_Buf_4"),\
+    _T("PL2_444AVS16_ChromaSiting_Buf_5"),\
+    _T("PL2_444DScale16_Buf_0"),\
+    _T("PL2_444DScale16_Buf_0_Rot_180"),\
+    _T("PL2_444DScale16_Buf_0_Rot_270"),\
+    _T("PL2_444DScale16_Buf_0_Rot_90"),\
+    _T("PL2_444DScale16_Buf_1"),\
+    _T("PL2_444DScale16_Buf_1_Rot_180"),\
+    _T("PL2_444DScale16_Buf_1_Rot_270"),\
+    _T("PL2_444DScale16_Buf_1_Rot_90"),\
+    _T("PL2_444DScale16_Buf_2"),\
+    _T("PL2_444DScale16_Buf_2_Rot_180"),\
+    _T("PL2_444DScale16_Buf_2_Rot_270"),\
+    _T("PL2_444DScale16_Buf_2_Rot_90"),\
+    _T("PL2_444DScale16_Buf_3"),\
+    _T("PL2_444DScale16_Buf_3_Rot_180"),\
+    _T("PL2_444DScale16_Buf_3_Rot_270"),\
+    _T("PL2_444DScale16_Buf_3_Rot_90"),\
+    _T("PL2_444DScale16_Buf_4"),\
+    _T("PL2_444DScale16_Buf_4_Rot_180"),\
+    _T("PL2_444DScale16_Buf_4_Rot_270"),\
+    _T("PL2_444DScale16_Buf_4_Rot_90"),\
+    _T("PL2_444DScale16_Buf_5"),\
+    _T("PL2_444DScale16_Buf_5_Rot_180"),\
+    _T("PL2_444DScale16_Buf_5_Rot_270"),\
+    _T("PL2_444DScale16_Buf_5_Rot_90"),\
+    _T("PL2_444DScale16_Buf_Sep_Alpha_4"),\
+    _T("PL2_444DScale16_Buf_Sep_Alpha_5"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_0"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_0_Rot_180"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_0_Rot_270"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_0_Rot_90"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_1"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_1_Rot_180"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_1_Rot_270"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_1_Rot_90"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_2"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_2_Rot_180"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_2_Rot_270"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_2_Rot_90"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_3"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_3_Rot_180"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_3_Rot_270"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_3_Rot_90"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_4"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_4_Rot_180"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_4_Rot_270"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_4_Rot_90"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_5"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_5_Rot_180"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_5_Rot_270"),\
+    _T("PL2_444DScale16_ChromaSiting_Buf_5_Rot_90"),\
+    _T("PL2_444Scale16_Buf_0"),\
+    _T("PL2_444Scale16_Buf_0_Rot_180"),\
+    _T("PL2_444Scale16_Buf_0_Rot_270"),\
+    _T("PL2_444Scale16_Buf_0_Rot_90"),\
+    _T("PL2_444Scale16_Buf_1"),\
+    _T("PL2_444Scale16_Buf_1_Rot_180"),\
+    _T("PL2_444Scale16_Buf_1_Rot_270"),\
+    _T("PL2_444Scale16_Buf_1_Rot_90"),\
+    _T("PL2_444Scale16_Buf_2"),\
+    _T("PL2_444Scale16_Buf_2_Rot_180"),\
+    _T("PL2_444Scale16_Buf_2_Rot_270"),\
+    _T("PL2_444Scale16_Buf_2_Rot_90"),\
+    _T("PL2_444Scale16_Buf_3"),\
+    _T("PL2_444Scale16_Buf_3_Rot_180"),\
+    _T("PL2_444Scale16_Buf_3_Rot_270"),\
+    _T("PL2_444Scale16_Buf_3_Rot_90"),\
+    _T("PL2_444Scale16_Buf_4"),\
+    _T("PL2_444Scale16_Buf_4_Rot_180"),\
+    _T("PL2_444Scale16_Buf_4_Rot_270"),\
+    _T("PL2_444Scale16_Buf_4_Rot_90"),\
+    _T("PL2_444Scale16_Buf_5"),\
+    _T("PL2_444Scale16_Buf_5_Rot_180"),\
+    _T("PL2_444Scale16_Buf_5_Rot_270"),\
+    _T("PL2_444Scale16_Buf_5_Rot_90"),\
+    _T("PL2_444Scale16_Buf_Sep_Alpha_4"),\
+    _T("PL2_444Scale16_Buf_Sep_Alpha_4_Rot_180"),\
+    _T("PL2_444Scale16_Buf_Sep_Alpha_4_Rot_270"),\
+    _T("PL2_444Scale16_Buf_Sep_Alpha_4_Rot_90"),\
+    _T("PL2_444Scale16_Buf_Sep_Alpha_5"),\
+    _T("PL2_444Scale16_Buf_Sep_Alpha_5_Rot_180"),\
+    _T("PL2_444Scale16_Buf_Sep_Alpha_5_Rot_270"),\
+    _T("PL2_444Scale16_Buf_Sep_Alpha_5_Rot_90"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_0"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_0_Rot_180"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_0_Rot_270"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_0_Rot_90"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_1"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_1_Rot_180"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_1_Rot_270"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_1_Rot_90"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_2"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_2_Rot_180"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_2_Rot_270"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_2_Rot_90"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_3"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_3_Rot_180"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_3_Rot_270"),\
+    _T("PL2_444Scale16_Chromasiting_Buf_3_Rot_90"),\
+    _T("PL2_444iDScale16_Buf_0"),\
+    _T("PL2_444iDScale16_Buf_1"),\
+    _T("PL2_444iDScale16_Buf_2"),\
+    _T("PL2_444iDScale16_Buf_3"),\
+    _T("PL2_444iScale16_Buf_0"),\
+    _T("PL2_444iScale16_Buf_0_Rot_180"),\
+    _T("PL2_444iScale16_Buf_0_Rot_270"),\
+    _T("PL2_444iScale16_Buf_0_Rot_90"),\
+    _T("PL2_444iScale16_Buf_1"),\
+    _T("PL2_444iScale16_Buf_1_Rot_180"),\
+    _T("PL2_444iScale16_Buf_1_Rot_270"),\
+    _T("PL2_444iScale16_Buf_1_Rot_90"),\
+    _T("PL2_444iScale16_Buf_2"),\
+    _T("PL2_444iScale16_Buf_2_Rot_180"),\
+    _T("PL2_444iScale16_Buf_2_Rot_270"),\
+    _T("PL2_444iScale16_Buf_2_Rot_90"),\
+    _T("PL2_444iScale16_Buf_3"),\
+    _T("PL2_444iScale16_Buf_3_Rot_180"),\
+    _T("PL2_444iScale16_Buf_3_Rot_270"),\
+    _T("PL2_444iScale16_Buf_3_Rot_90"),\
+    _T("PL2_AVS_Mirror_H_L0"),\
+    _T("PL2_AVS_Mirror_H_L0_DualOutput"),\
+    _T("PL2_AVS_Mirror_V_L0"),\
+    _T("PL2_AVS_Rotate90_Mirror_H_L0"),\
+    _T("PL2_AVS_Rotate90_Mirror_V_L0"),\
+    _T("PL2_AVS_Rotate_L0_180"),\
+    _T("PL2_AVS_Rotate_L0_270"),\
+    _T("PL2_AVS_Rotate_L0_90"),\
+    _T("PL2_Copy"),\
+    _T("PL2_Scale_Mirror_H_L0"),\
+    _T("PL2_Scale_Mirror_H_L0_DualOutput"),\
+    _T("PL2_Scale_Mirror_V_L0"),\
+    _T("PL2_Scale_Rotate90_Mirror_H_L0"),\
+    _T("PL2_Scale_Rotate90_Mirror_V_L0"),\
+    _T("PL2_Scale_Rotate_L0_180"),\
+    _T("PL2_Scale_Rotate_L0_270"),\
+    _T("PL2_Scale_Rotate_L0_90"),\
+    _T("PL3_444AVS16_Buf_0"),\
+    _T("PL3_444AVS16_Buf_0_Rot_180"),\
+    _T("PL3_444AVS16_Buf_0_Rot_270"),\
+    _T("PL3_444AVS16_Buf_0_Rot_90"),\
+    _T("PL3_444AVS16_Buf_1"),\
+    _T("PL3_444AVS16_Buf_1_Rot_180"),\
+    _T("PL3_444AVS16_Buf_1_Rot_270"),\
+    _T("PL3_444AVS16_Buf_1_Rot_90"),\
+    _T("PL3_444AVS16_Buf_2"),\
+    _T("PL3_444AVS16_Buf_2_Rot_180"),\
+    _T("PL3_444AVS16_Buf_2_Rot_270"),\
+    _T("PL3_444AVS16_Buf_2_Rot_90"),\
+    _T("PL3_444AVS16_Buf_3"),\
+    _T("PL3_444AVS16_Buf_3_Rot_180"),\
+    _T("PL3_444AVS16_Buf_3_Rot_270"),\
+    _T("PL3_444AVS16_Buf_3_Rot_90"),\
+    _T("PL3_444AVS16_Buf_4"),\
+    _T("PL3_444AVS16_Buf_4_Rot_180"),\
+    _T("PL3_444AVS16_Buf_4_Rot_270"),\
+    _T("PL3_444AVS16_Buf_4_Rot_90"),\
+    _T("PL3_444AVS16_Buf_5"),\
+    _T("PL3_444AVS16_Buf_5_Rot_180"),\
+    _T("PL3_444AVS16_Buf_5_Rot_270"),\
+    _T("PL3_444AVS16_Buf_5_Rot_90"),\
+    _T("PL3_444DScale16_Buf_0"),\
+    _T("PL3_444DScale16_Buf_0_Rot_180"),\
+    _T("PL3_444DScale16_Buf_0_Rot_270"),\
+    _T("PL3_444DScale16_Buf_0_Rot_90"),\
+    _T("PL3_444DScale16_Buf_1"),\
+    _T("PL3_444DScale16_Buf_1_Rot_180"),\
+    _T("PL3_444DScale16_Buf_1_Rot_270"),\
+    _T("PL3_444DScale16_Buf_1_Rot_90"),\
+    _T("PL3_444DScale16_Buf_2"),\
+    _T("PL3_444DScale16_Buf_2_Rot_180"),\
+    _T("PL3_444DScale16_Buf_2_Rot_270"),\
+    _T("PL3_444DScale16_Buf_2_Rot_90"),\
+    _T("PL3_444DScale16_Buf_3"),\
+    _T("PL3_444DScale16_Buf_3_Rot_180"),\
+    _T("PL3_444DScale16_Buf_3_Rot_270"),\
+    _T("PL3_444DScale16_Buf_3_Rot_90"),\
+    _T("PL3_444DScale16_Buf_4"),\
+    _T("PL3_444DScale16_Buf_4_Rot_180"),\
+    _T("PL3_444DScale16_Buf_4_Rot_270"),\
+    _T("PL3_444DScale16_Buf_4_Rot_90"),\
+    _T("PL3_444DScale16_Buf_5"),\
+    _T("PL3_444DScale16_Buf_5_Rot_180"),\
+    _T("PL3_444DScale16_Buf_5_Rot_270"),\
+    _T("PL3_444DScale16_Buf_5_Rot_90"),\
+    _T("PL3_444Scale16_Buf_0"),\
+    _T("PL3_444Scale16_Buf_0_Rot_180"),\
+    _T("PL3_444Scale16_Buf_0_Rot_270"),\
+    _T("PL3_444Scale16_Buf_0_Rot_90"),\
+    _T("PL3_444Scale16_Buf_1"),\
+    _T("PL3_444Scale16_Buf_1_Rot_180"),\
+    _T("PL3_444Scale16_Buf_1_Rot_270"),\
+    _T("PL3_444Scale16_Buf_1_Rot_90"),\
+    _T("PL3_444Scale16_Buf_2"),\
+    _T("PL3_444Scale16_Buf_2_Rot_180"),\
+    _T("PL3_444Scale16_Buf_2_Rot_270"),\
+    _T("PL3_444Scale16_Buf_2_Rot_90"),\
+    _T("PL3_444Scale16_Buf_3"),\
+    _T("PL3_444Scale16_Buf_3_Rot_180"),\
+    _T("PL3_444Scale16_Buf_3_Rot_270"),\
+    _T("PL3_444Scale16_Buf_3_Rot_90"),\
+    _T("PL3_444Scale16_Buf_4"),\
+    _T("PL3_444Scale16_Buf_4_Rot_180"),\
+    _T("PL3_444Scale16_Buf_4_Rot_270"),\
+    _T("PL3_444Scale16_Buf_4_Rot_90"),\
+    _T("PL3_444Scale16_Buf_5"),\
+    _T("PL3_444Scale16_Buf_5_Rot_180"),\
+    _T("PL3_444Scale16_Buf_5_Rot_270"),\
+    _T("PL3_444Scale16_Buf_5_Rot_90"),\
+    _T("PL3_444iDScale16_Buf_0"),\
+    _T("PL3_444iDScale16_Buf_1"),\
+    _T("PL3_444iDScale16_Buf_2"),\
+    _T("PL3_444iDScale16_Buf_3"),\
+    _T("PL3_444iScale16_Buf_0"),\
+    _T("PL3_444iScale16_Buf_0_Rot_180"),\
+    _T("PL3_444iScale16_Buf_0_Rot_270"),\
+    _T("PL3_444iScale16_Buf_0_Rot_90"),\
+    _T("PL3_444iScale16_Buf_1"),\
+    _T("PL3_444iScale16_Buf_1_Rot_180"),\
+    _T("PL3_444iScale16_Buf_1_Rot_270"),\
+    _T("PL3_444iScale16_Buf_1_Rot_90"),\
+    _T("PL3_444iScale16_Buf_2"),\
+    _T("PL3_444iScale16_Buf_2_Rot_180"),\
+    _T("PL3_444iScale16_Buf_2_Rot_270"),\
+    _T("PL3_444iScale16_Buf_2_Rot_90"),\
+    _T("PL3_444iScale16_Buf_3"),\
+    _T("PL3_444iScale16_Buf_3_Rot_180"),\
+    _T("PL3_444iScale16_Buf_3_Rot_270"),\
+    _T("PL3_444iScale16_Buf_3_Rot_90"),\
+    _T("PL3_AVS_Rotate_L0_180"),\
+    _T("PL3_AVS_Rotate_L0_270"),\
+    _T("PL3_AVS_Rotate_L0_90"),\
+    _T("PL3_Scale_Rotate_L0_180"),\
+    _T("PL3_Scale_Rotate_L0_270"),\
+    _T("PL3_Scale_Rotate_L0_90"),\
+    _T("PLY_444DScale16_2f_Buf_0"),\
+    _T("PLY_444DScale16_2f_Buf_1"),\
+    _T("PLY_444DScale16_2f_Buf_2"),\
+    _T("PLY_444DScale16_2f_Buf_3"),\
+    _T("PLY_444DScale16_Buf_0"),\
+    _T("PLY_444DScale16_Buf_0_Rot_180"),\
+    _T("PLY_444DScale16_Buf_0_Rot_270"),\
+    _T("PLY_444DScale16_Buf_0_Rot_90"),\
+    _T("PLY_444DScale16_Buf_1"),\
+    _T("PLY_444DScale16_Buf_1_Rot_180"),\
+    _T("PLY_444DScale16_Buf_1_Rot_270"),\
+    _T("PLY_444DScale16_Buf_1_Rot_90"),\
+    _T("PLY_444DScale16_Buf_2"),\
+    _T("PLY_444DScale16_Buf_2_Rot_180"),\
+    _T("PLY_444DScale16_Buf_2_Rot_270"),\
+    _T("PLY_444DScale16_Buf_2_Rot_90"),\
+    _T("PLY_444DScale16_Buf_3"),\
+    _T("PLY_444DScale16_Buf_3_Rot_180"),\
+    _T("PLY_444DScale16_Buf_3_Rot_270"),\
+    _T("PLY_444DScale16_Buf_3_Rot_90"),\
+    _T("PartBlend_444_16"),\
+    _T("Prepare_LumaKey_SampleUnorm"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_mirror_h"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_mirror_v"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_rot_180"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_rot_270"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_rot_90"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_rot_90_mirror_h"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_rot_90_mirror_v"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_1_8th"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_mirror_h"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_mirror_v"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_rot_180"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_rot_270"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_rot_90"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_rot_90_mirror_h"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_1_8th_rot_90_mirror_v"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_mirror_h"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_mirror_v"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_rot_180"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_rot_270"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_rot_90"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_rot_90_mirror_h"),\
+    _T("R8G8B8A8_DP_DownScaling_4x4_scale_to_any_ratio_rot_90_mirror_v"),\
+    _T("R8G8B8A8_DP_DownScaling_8x8"),\
+    _T("R8G8B8A8_DP_DownScaling_8x8_mirror_h"),\
+    _T("R8G8B8A8_DP_DownScaling_8x8_mirror_v"),\
+    _T("R8G8B8A8_DP_DownScaling_8x8_rot_180"),\
+    _T("R8G8B8A8_DP_DownScaling_8x8_rot_270"),\
+    _T("R8G8B8A8_DP_DownScaling_8x8_rot_90"),\
+    _T("R8G8B8A8_DP_DownScaling_8x8_rot_90_mirror_h"),\
+    _T("R8G8B8A8_DP_DownScaling_8x8_rot_90_mirror_v"),\
+    _T("R8G8B8A8_DP_UpScaling_16x16"),\
+    _T("R8G8B8A8_DP_UpScaling_16x16_mirror_h"),\
+    _T("R8G8B8A8_DP_UpScaling_16x16_mirror_v"),\
+    _T("R8G8B8A8_DP_UpScaling_16x16_rot_180"),\
+    _T("R8G8B8A8_DP_UpScaling_16x16_rot_270"),\
+    _T("R8G8B8A8_DP_UpScaling_16x16_rot_90"),\
+    _T("R8G8B8A8_DP_UpScaling_16x16_rot_90_mirror_h"),\
+    _T("R8G8B8A8_DP_UpScaling_16x16_rot_90_mirror_v"),\
+    _T("RGB2sRGB"),\
+    _T("RGBP_DP_DownScaling_8x8"),\
+    _T("RGBP_DP_UpScaling_16x16"),\
+    _T("Rotate_90_Mirror_AVS_H_L0"),\
+    _T("Rotate_90_Mirror_AVS_V_L0"),\
+    _T("Rotate_90_Mirror_H_scale_L0"),\
+    _T("Rotate_90_Mirror_V_scale_L0"),\
+    _T("Rotate_AVS_L0_180"),\
+    _T("Rotate_AVS_L0_270"),\
+    _T("Rotate_AVS_L0_90"),\
+    _T("Rotate_Scale_L0_180"),\
+    _T("Rotate_Scale_L0_270"),\
+    _T("Rotate_Scale_L0_90"),\
+    _T("SIP_Debug"),\
+    _T("Save_444AVS16_ARGB"),\
+    _T("Save_444AVS16_ARGB_64Byte"),\
+    _T("Save_444AVS16_NV12"),\
+    _T("Save_444AVS16_NV21"),\
+    _T("Save_444AVS16_PA"),\
+    _T("Save_444AVS16_PL3"),\
+    _T("Save_444AVS16_R10G10B10"),\
+    _T("Save_444AVS16_R10G10B10A2"),\
+    _T("Save_444AVS16_R10G10B10X2"),\
+    _T("Save_444AVS16_RGB"),\
+    _T("Save_444AVS16_RGB16"),\
+    _T("Save_444AVS16_RGB_64Byte"),\
+    _T("Save_444AVS16_SrcAYUV"),\
+    _T("Save_444AVS16_XRGB"),\
+    _T("Save_444AVS16_XRGB_64Byte"),\
+    _T("Save_444Scale16_ARGB"),\
+    _T("Save_444Scale16_ARGB_64Byte"),\
+    _T("Save_444Scale16_Dither_NV12"),\
+    _T("Save_444Scale16_Dither_NV21"),\
+    _T("Save_444Scale16_Dither_PA"),\
+    _T("Save_444Scale16_Dither_PA_32X16"),\
+    _T("Save_444Scale16_Dither_PL3"),\
+    _T("Save_444Scale16_Dither_RGB"),\
+    _T("Save_444Scale16_Dither_RGB16"),\
+    _T("Save_444Scale16_Dither_RGB_64Byte"),\
+    _T("Save_444Scale16_Dither_VUYA"),\
+    _T("Save_444Scale16_Dither_XRGB"),\
+    _T("Save_444Scale16_Dither_XRGB_64Byte"),\
+    _T("Save_444Scale16_NV12"),\
+    _T("Save_444Scale16_NV21"),\
+    _T("Save_444Scale16_P010"),\
+    _T("Save_444Scale16_P016"),\
+    _T("Save_444Scale16_PA"),\
+    _T("Save_444Scale16_PA_32X16"),\
+    _T("Save_444Scale16_PL3"),\
+    _T("Save_444Scale16_PLY"),\
+    _T("Save_444Scale16_R10G10B10"),\
+    _T("Save_444Scale16_R10G10B10A2"),\
+    _T("Save_444Scale16_R10G10B10X2"),\
+    _T("Save_444Scale16_R10G10B10XR"),\
+    _T("Save_444Scale16_R10G10B10XRA2"),\
+    _T("Save_444Scale16_R10G10B10XRX2"),\
+    _T("Save_444Scale16_RGB"),\
+    _T("Save_444Scale16_RGB16"),\
+    _T("Save_444Scale16_RGBP"),\
+    _T("Save_444Scale16_RGB_64Byte"),\
+    _T("Save_444Scale16_SrcVUYA"),\
+    _T("Save_444Scale16_SrcY416"),\
+    _T("Save_444Scale16_VUYA"),\
+    _T("Save_444Scale16_XRGB"),\
+    _T("Save_444Scale16_XRGB_64Byte"),\
+    _T("Save_444Scale16_Y210"),\
+    _T("Save_444Scale16_Y216"),\
+    _T("Save_444Scale16_Y410"),\
+    _T("Save_444Scale16_Y416"),\
+    _T("Save_ARGB_16x16"),\
+    _T("Save_ARGB_4x4"),\
+    _T("Save_ARGB_8x8"),\
+    _T("Save_NV12_16x16"),\
+    _T("Save_NV12_4x4"),\
+    _T("Save_NV12_8x8"),\
+    _T("Save_RGBP_16x16"),\
+    _T("Save_RGBP_4x4"),\
+    _T("Save_RGBP_8x8"),\
+    _T("Secure_Block_Copy"),\
+    _T("Set_Buf0_Buf4"),\
+    _T("Set_Buf1_Buf5"),\
+    _T("Set_Buf2_Buf4"),\
+    _T("Set_Buf3_Buf5"),\
+    _T("Set_CSC_Src_Buf0"),\
+    _T("Set_CSC_Src_Buf1"),\
+    _T("Set_CSC_Src_Buf2"),\
+    _T("Set_CSC_Src_Buf3"),\
+    _T("Set_CSC_Src_Buf4"),\
+    _T("Set_CSC_Src_Buf5"),\
+    _T("Set_CURBE_CSC_Coeff"),\
+    _T("Set_ColorE_Src_Buf0"),\
+    _T("Set_ColorE_Src_Buf1"),\
+    _T("Set_ColorE_Src_Buf2"),\
+    _T("Set_ColorE_Src_Buf3"),\
+    _T("Set_Dest_Surf_Indexes_Primary"),\
+    _T("Set_Dest_Surf_Indexes_Secondary"),\
+    _T("Set_GammaC_Src_Buf0"),\
+    _T("Set_GammaC_Src_Buf1"),\
+    _T("Set_GammaC_Src_Buf2"),\
+    _T("Set_GammaC_Src_Buf3"),\
+    _T("Set_Layer_0"),\
+    _T("Set_Layer_1"),\
+    _T("Set_Layer_1_AVS"),\
+    _T("Set_Layer_2"),\
+    _T("Set_Layer_3"),\
+    _T("Set_Layer_4"),\
+    _T("Set_Layer_5"),\
+    _T("Set_Layer_6"),\
+    _T("Set_Layer_7"),\
+    _T("Set_Patched_CSC_Coeff"),\
+    _T("Set_Scale_Buf_0123_Colorfill"),\
+    _T("Set_Sec_Half_Buf45"),\
+    _T("Shuffle_444AVS16_Buf_0"),\
+    _T("Shuffle_444AVS16_Buf_1"),\
+    _T("Shuffle_444AVS16_Buf_2"),\
+    _T("Shuffle_444AVS16_Buf_3"),\
+    _T("Shuffle_444AVS16_Buf_4"),\
+    _T("Shuffle_444AVS16_Buf_5"),\
+    _T("SrcBlend_444_16"),\
+    _T("SrcBlend_4bits_444_16"),\
+    _T("UpdateDNState"),\
+    _T("VP_Setup"),\
+    _T("VP_Setup_MediaWalker"),\
+    _T("VP_Setup_MediaWalker_32X16_Design"),\
+    _T("VP_Setup_MediaWalker_32x32_Color"),\
+    _T("XOR_Composite_444_16"),\
+    _T("XOR_Mono_Composite_444_16"),\
+    _T("Y210_444DScale16_Buf_0"),\
+    _T("Y210_444DScale16_Buf_0_Rot_180"),\
+    _T("Y210_444DScale16_Buf_0_Rot_270"),\
+    _T("Y210_444DScale16_Buf_0_Rot_90"),\
+    _T("Y210_444DScale16_Buf_1"),\
+    _T("Y210_444DScale16_Buf_1_Rot_180"),\
+    _T("Y210_444DScale16_Buf_1_Rot_270"),\
+    _T("Y210_444DScale16_Buf_1_Rot_90"),\
+    _T("Y210_444DScale16_Buf_2"),\
+    _T("Y210_444DScale16_Buf_2_Rot_180"),\
+    _T("Y210_444DScale16_Buf_2_Rot_270"),\
+    _T("Y210_444DScale16_Buf_2_Rot_90"),\
+    _T("Y210_444DScale16_Buf_3"),\
+    _T("Y210_444DScale16_Buf_3_Rot_180"),\
+    _T("Y210_444DScale16_Buf_3_Rot_270"),\
+    _T("Y210_444DScale16_Buf_3_Rot_90"),\
+    _T("Y210_444DScale16_Buf_4"),\
+    _T("Y210_444DScale16_Buf_4_Rot_180"),\
+    _T("Y210_444DScale16_Buf_4_Rot_270"),\
+    _T("Y210_444DScale16_Buf_4_Rot_90"),\
+    _T("Y210_444DScale16_Buf_5"),\
+    _T("Y210_444DScale16_Buf_5_Rot_180"),\
+    _T("Y210_444DScale16_Buf_5_Rot_270"),\
+    _T("Y210_444DScale16_Buf_5_Rot_90"),\
+    _T("Y210_444Scale16_Buf_0"),\
+    _T("Y210_444Scale16_Buf_0_Rot_180"),\
+    _T("Y210_444Scale16_Buf_0_Rot_270"),\
+    _T("Y210_444Scale16_Buf_0_Rot_90"),\
+    _T("Y210_444Scale16_Buf_1"),\
+    _T("Y210_444Scale16_Buf_1_Rot_180"),\
+    _T("Y210_444Scale16_Buf_1_Rot_270"),\
+    _T("Y210_444Scale16_Buf_1_Rot_90"),\
+    _T("Y210_444Scale16_Buf_2"),\
+    _T("Y210_444Scale16_Buf_2_Rot_180"),\
+    _T("Y210_444Scale16_Buf_2_Rot_270"),\
+    _T("Y210_444Scale16_Buf_2_Rot_90"),\
+    _T("Y210_444Scale16_Buf_3"),\
+    _T("Y210_444Scale16_Buf_3_Rot_180"),\
+    _T("Y210_444Scale16_Buf_3_Rot_270"),\
+    _T("Y210_444Scale16_Buf_3_Rot_90"),\
+    _T("Y210_444Scale16_Buf_4"),\
+    _T("Y210_444Scale16_Buf_4_Rot_180"),\
+    _T("Y210_444Scale16_Buf_4_Rot_270"),\
+    _T("Y210_444Scale16_Buf_4_Rot_90"),\
+    _T("Y210_444Scale16_Buf_5"),\
+    _T("Y210_444Scale16_Buf_5_Rot_180"),\
+    _T("Y210_444Scale16_Buf_5_Rot_270"),\
+    _T("Y210_444Scale16_Buf_5_Rot_90"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_0"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_0_Rot_180"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_0_Rot_270"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_0_Rot_90"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_1"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_1_Rot_180"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_1_Rot_270"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_1_Rot_90"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_2"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_2_Rot_180"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_2_Rot_270"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_2_Rot_90"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_3"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_3_Rot_180"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_3_Rot_270"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_3_Rot_90"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_4"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_4_Rot_180"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_4_Rot_270"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_4_Rot_90"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_5"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_5_Rot_180"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_5_Rot_270"),\
+    _T("Y210_444_AVS16_Y_Scale16_UV_Buf_5_Rot_90"),\
+    _T("Y410_444AVS16_Buf_0"),\
+    _T("Y410_444AVS16_Buf_0_Rot_180"),\
+    _T("Y410_444AVS16_Buf_0_Rot_270"),\
+    _T("Y410_444AVS16_Buf_0_Rot_90"),\
+    _T("Y410_444AVS16_Buf_1"),\
+    _T("Y410_444AVS16_Buf_1_Rot_180"),\
+    _T("Y410_444AVS16_Buf_1_Rot_270"),\
+    _T("Y410_444AVS16_Buf_1_Rot_90"),\
+    _T("Y410_444AVS16_Buf_2"),\
+    _T("Y410_444AVS16_Buf_2_Rot_180"),\
+    _T("Y410_444AVS16_Buf_2_Rot_270"),\
+    _T("Y410_444AVS16_Buf_2_Rot_90"),\
+    _T("Y410_444AVS16_Buf_3"),\
+    _T("Y410_444AVS16_Buf_3_Rot_180"),\
+    _T("Y410_444AVS16_Buf_3_Rot_270"),\
+    _T("Y410_444AVS16_Buf_3_Rot_90"),\
+    _T("Y410_444AVS16_Buf_4"),\
+    _T("Y410_444AVS16_Buf_4_Rot_180"),\
+    _T("Y410_444AVS16_Buf_4_Rot_270"),\
+    _T("Y410_444AVS16_Buf_4_Rot_90"),\
+    _T("Y410_444AVS16_Buf_5"),\
+    _T("Y410_444AVS16_Buf_5_Rot_180"),\
+    _T("Y410_444AVS16_Buf_5_Rot_270"),\
+    _T("Y410_444AVS16_Buf_5_Rot_90"),\
+    _T("Y410_444DScale16_Buf_0"),\
+    _T("Y410_444DScale16_Buf_0_Rot_180"),\
+    _T("Y410_444DScale16_Buf_0_Rot_270"),\
+    _T("Y410_444DScale16_Buf_0_Rot_90"),\
+    _T("Y410_444DScale16_Buf_1"),\
+    _T("Y410_444DScale16_Buf_1_Rot_180"),\
+    _T("Y410_444DScale16_Buf_1_Rot_270"),\
+    _T("Y410_444DScale16_Buf_1_Rot_90"),\
+    _T("Y410_444DScale16_Buf_2"),\
+    _T("Y410_444DScale16_Buf_2_Rot_180"),\
+    _T("Y410_444DScale16_Buf_2_Rot_270"),\
+    _T("Y410_444DScale16_Buf_2_Rot_90"),\
+    _T("Y410_444DScale16_Buf_3"),\
+    _T("Y410_444DScale16_Buf_3_Rot_180"),\
+    _T("Y410_444DScale16_Buf_3_Rot_270"),\
+    _T("Y410_444DScale16_Buf_3_Rot_90"),\
+    _T("Y410_444DScale16_Buf_4"),\
+    _T("Y410_444DScale16_Buf_4_Rot_180"),\
+    _T("Y410_444DScale16_Buf_4_Rot_270"),\
+    _T("Y410_444DScale16_Buf_4_Rot_90"),\
+    _T("Y410_444DScale16_Buf_5"),\
+    _T("Y410_444DScale16_Buf_5_Rot_180"),\
+    _T("Y410_444DScale16_Buf_5_Rot_270"),\
+    _T("Y410_444DScale16_Buf_5_Rot_90"),\
+    _T("Y410_444Scale16_Buf_0"),\
+    _T("Y410_444Scale16_Buf_0_Rot_180"),\
+    _T("Y410_444Scale16_Buf_0_Rot_270"),\
+    _T("Y410_444Scale16_Buf_0_Rot_90"),\
+    _T("Y410_444Scale16_Buf_1"),\
+    _T("Y410_444Scale16_Buf_1_Rot_180"),\
+    _T("Y410_444Scale16_Buf_1_Rot_270"),\
+    _T("Y410_444Scale16_Buf_1_Rot_90"),\
+    _T("Y410_444Scale16_Buf_2"),\
+    _T("Y410_444Scale16_Buf_2_Rot_180"),\
+    _T("Y410_444Scale16_Buf_2_Rot_270"),\
+    _T("Y410_444Scale16_Buf_2_Rot_90"),\
+    _T("Y410_444Scale16_Buf_3"),\
+    _T("Y410_444Scale16_Buf_3_Rot_180"),\
+    _T("Y410_444Scale16_Buf_3_Rot_270"),\
+    _T("Y410_444Scale16_Buf_3_Rot_90"),\
+    _T("Y410_444Scale16_Buf_4"),\
+    _T("Y410_444Scale16_Buf_4_Rot_180"),\
+    _T("Y410_444Scale16_Buf_4_Rot_270"),\
+    _T("Y410_444Scale16_Buf_4_Rot_90"),\
+    _T("Y410_444Scale16_Buf_5"),\
+    _T("Y410_444Scale16_Buf_5_Rot_180"),\
+    _T("Y410_444Scale16_Buf_5_Rot_270"),\
+    _T("Y410_444Scale16_Buf_5_Rot_90"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_0"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_0_Rot_180"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_0_Rot_270"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_0_Rot_90"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_1"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_1_Rot_180"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_1_Rot_270"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_1_Rot_90"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_2"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_2_Rot_180"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_2_Rot_270"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_2_Rot_90"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_3"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_3_Rot_180"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_3_Rot_270"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_3_Rot_90"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_4"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_4_Rot_180"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_4_Rot_270"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_4_Rot_90"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_5"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_5_Rot_180"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_5_Rot_270"),\
+    _T("YUY2_444Scale16_Chromasiting_Buf_5_Rot_90"),\
+    _T("camera_pipe_CalcParams"),\
+    _T("fast_avs_1_to_n"),\
+    _T("return"),\
+    _T("sampler_scaling"),\
+    _T("zzz_preproduction"),\
+    _T("zzz_preproduction_ALLPL2Copy_Gen"),\
+    _T("zzz_preproduction_HDR_mandatory_Gen"),\
+    _T("zzz_preproduction_HDR_per_frame_stat_Gen"),\
+    _T("zzz_preproduction_gcBltPS_32_To_128_Mirror_Gen"),\
+    _T("zzz_preproduction_gcBltPS_64_To_128_Mirror_Gen"),\
+    _T("zzz_preproduction_gcBltPS_Gen"),\
+    _T("zzz_preproduction_gcBlt_D11"),\
+    _T("zzz_preproduction_gcClearNoReplicatePS_Gen"),\
+    _T("zzz_preproduction_gcClearReplicatePS_Gen"),\
+    _T("zzz_preproduction_gcClear_NoReplicate_D11"),\
+    _T("zzz_preproduction_gcClear_Replicate_D11"),\
+    _T("zzz_preproduction_gcColorFillNoReplicatePS_Gen"),\
+    _T("zzz_preproduction_gcColorFillReplicatePS_Gen"),\
+    _T("zzz_preproduction_gcFastClearReplicatePS_Gen"),\
+    _T("zzz_preproduction_gcFastClear_Replicate_D11"),\
+    _T("zzz_preproduction_gcResourceCopy_D11"),\
+    _T("zzz_production"),\
+    _T("zzz_production_ALLPL2Copy_Gen"),\
+    _T("zzz_production_HDR_mandatory_Gen"),\
+    _T("zzz_production_HDR_per_frame_stat_Gen"),\
+    _T("zzz_production_gcBltPS_32_To_128_Mirror_Gen"),\
+    _T("zzz_production_gcBltPS_64_To_128_Mirror_Gen"),\
+    _T("zzz_production_gcBltPS_Gen"),\
+    _T("zzz_production_gcBlt_D11"),\
+    _T("zzz_production_gcClearNoReplicatePS_Gen"),\
+    _T("zzz_production_gcClearReplicatePS_Gen"),\
+    _T("zzz_production_gcClear_NoReplicate_D11"),\
+    _T("zzz_production_gcClear_Replicate_D11"),\
+    _T("zzz_production_gcColorFillNoReplicatePS_Gen"),\
+    _T("zzz_production_gcColorFillReplicatePS_Gen"),\
+    _T("zzz_production_gcFastClearReplicatePS_Gen"),\
+    _T("zzz_production_gcFastClear_Replicate_D11"),\
+    _T("zzz_production_gcResourceCopy_D11"),\
+    _T("")
+#else // !_DEBUG && !_RELEASE_INTERNAL
+#define IDR_VP_KERNEL_NAMES   \
+    _T("000"),\
+    _T("001"),\
+    _T("002"),\
+    _T("003"),\
+    _T("004"),\
+    _T("005"),\
+    _T("006"),\
+    _T("007"),\
+    _T("008"),\
+    _T("009"),\
+    _T("010"),\
+    _T("011"),\
+    _T("012"),\
+    _T("013"),\
+    _T("014"),\
+    _T("015"),\
+    _T("016"),\
+    _T("017"),\
+    _T("018"),\
+    _T("019"),\
+    _T("020"),\
+    _T("021"),\
+    _T("022"),\
+    _T("023"),\
+    _T("024"),\
+    _T("025"),\
+    _T("026"),\
+    _T("027"),\
+    _T("028"),\
+    _T("029"),\
+    _T("030"),\
+    _T("031"),\
+    _T("032"),\
+    _T("033"),\
+    _T("034"),\
+    _T("035"),\
+    _T("036"),\
+    _T("037"),\
+    _T("038"),\
+    _T("039"),\
+    _T("040"),\
+    _T("041"),\
+    _T("042"),\
+    _T("043"),\
+    _T("044"),\
+    _T("045"),\
+    _T("046"),\
+    _T("047"),\
+    _T("048"),\
+    _T("049"),\
+    _T("050"),\
+    _T("051"),\
+    _T("052"),\
+    _T("053"),\
+    _T("054"),\
+    _T("055"),\
+    _T("056"),\
+    _T("057"),\
+    _T("058"),\
+    _T("059"),\
+    _T("060"),\
+    _T("061"),\
+    _T("062"),\
+    _T("063"),\
+    _T("064"),\
+    _T("065"),\
+    _T("066"),\
+    _T("067"),\
+    _T("068"),\
+    _T("069"),\
+    _T("070"),\
+    _T("071"),\
+    _T("072"),\
+    _T("073"),\
+    _T("074"),\
+    _T("075"),\
+    _T("076"),\
+    _T("077"),\
+    _T("078"),\
+    _T("079"),\
+    _T("080"),\
+    _T("081"),\
+    _T("082"),\
+    _T("083"),\
+    _T("084"),\
+    _T("085"),\
+    _T("086"),\
+    _T("087"),\
+    _T("088"),\
+    _T("089"),\
+    _T("090"),\
+    _T("091"),\
+    _T("092"),\
+    _T("093"),\
+    _T("094"),\
+    _T("095"),\
+    _T("096"),\
+    _T("097"),\
+    _T("098"),\
+    _T("099"),\
+    _T("100"),\
+    _T("101"),\
+    _T("102"),\
+    _T("103"),\
+    _T("104"),\
+    _T("105"),\
+    _T("106"),\
+    _T("107"),\
+    _T("108"),\
+    _T("109"),\
+    _T("110"),\
+    _T("111"),\
+    _T("112"),\
+    _T("113"),\
+    _T("114"),\
+    _T("115"),\
+    _T("116"),\
+    _T("117"),\
+    _T("118"),\
+    _T("119"),\
+    _T("120"),\
+    _T("121"),\
+    _T("122"),\
+    _T("123"),\
+    _T("124"),\
+    _T("125"),\
+    _T("126"),\
+    _T("127"),\
+    _T("128"),\
+    _T("129"),\
+    _T("130"),\
+    _T("131"),\
+    _T("132"),\
+    _T("133"),\
+    _T("134"),\
+    _T("135"),\
+    _T("136"),\
+    _T("137"),\
+    _T("138"),\
+    _T("139"),\
+    _T("140"),\
+    _T("141"),\
+    _T("142"),\
+    _T("143"),\
+    _T("144"),\
+    _T("145"),\
+    _T("146"),\
+    _T("147"),\
+    _T("148"),\
+    _T("149"),\
+    _T("150"),\
+    _T("151"),\
+    _T("152"),\
+    _T("153"),\
+    _T("154"),\
+    _T("155"),\
+    _T("156"),\
+    _T("157"),\
+    _T("158"),\
+    _T("159"),\
+    _T("160"),\
+    _T("161"),\
+    _T("162"),\
+    _T("163"),\
+    _T("164"),\
+    _T("165"),\
+    _T("166"),\
+    _T("167"),\
+    _T("168"),\
+    _T("169"),\
+    _T("170"),\
+    _T("171"),\
+    _T("172"),\
+    _T("173"),\
+    _T("174"),\
+    _T("175"),\
+    _T("176"),\
+    _T("177"),\
+    _T("178"),\
+    _T("179"),\
+    _T("180"),\
+    _T("181"),\
+    _T("182"),\
+    _T("183"),\
+    _T("184"),\
+    _T("185"),\
+    _T("186"),\
+    _T("187"),\
+    _T("188"),\
+    _T("189"),\
+    _T("190"),\
+    _T("191"),\
+    _T("192"),\
+    _T("193"),\
+    _T("194"),\
+    _T("195"),\
+    _T("196"),\
+    _T("197"),\
+    _T("198"),\
+    _T("199"),\
+    _T("200"),\
+    _T("201"),\
+    _T("202"),\
+    _T("203"),\
+    _T("204"),\
+    _T("205"),\
+    _T("206"),\
+    _T("207"),\
+    _T("208"),\
+    _T("209"),\
+    _T("210"),\
+    _T("211"),\
+    _T("212"),\
+    _T("213"),\
+    _T("214"),\
+    _T("215"),\
+    _T("216"),\
+    _T("217"),\
+    _T("218"),\
+    _T("219"),\
+    _T("220"),\
+    _T("221"),\
+    _T("222"),\
+    _T("223"),\
+    _T("224"),\
+    _T("225"),\
+    _T("226"),\
+    _T("227"),\
+    _T("228"),\
+    _T("229"),\
+    _T("230"),\
+    _T("231"),\
+    _T("232"),\
+    _T("233"),\
+    _T("234"),\
+    _T("235"),\
+    _T("236"),\
+    _T("237"),\
+    _T("238"),\
+    _T("239"),\
+    _T("240"),\
+    _T("241"),\
+    _T("242"),\
+    _T("243"),\
+    _T("244"),\
+    _T("245"),\
+    _T("246"),\
+    _T("247"),\
+    _T("248"),\
+    _T("249"),\
+    _T("250"),\
+    _T("251"),\
+    _T("252"),\
+    _T("253"),\
+    _T("254"),\
+    _T("255"),\
+    _T("256"),\
+    _T("257"),\
+    _T("258"),\
+    _T("259"),\
+    _T("260"),\
+    _T("261"),\
+    _T("262"),\
+    _T("263"),\
+    _T("264"),\
+    _T("265"),\
+    _T("266"),\
+    _T("267"),\
+    _T("268"),\
+    _T("269"),\
+    _T("270"),\
+    _T("271"),\
+    _T("272"),\
+    _T("273"),\
+    _T("274"),\
+    _T("275"),\
+    _T("276"),\
+    _T("277"),\
+    _T("278"),\
+    _T("279"),\
+    _T("280"),\
+    _T("281"),\
+    _T("282"),\
+    _T("283"),\
+    _T("284"),\
+    _T("285"),\
+    _T("286"),\
+    _T("287"),\
+    _T("288"),\
+    _T("289"),\
+    _T("290"),\
+    _T("291"),\
+    _T("292"),\
+    _T("293"),\
+    _T("294"),\
+    _T("295"),\
+    _T("296"),\
+    _T("297"),\
+    _T("298"),\
+    _T("299"),\
+    _T("300"),\
+    _T("301"),\
+    _T("302"),\
+    _T("303"),\
+    _T("304"),\
+    _T("305"),\
+    _T("306"),\
+    _T("307"),\
+    _T("308"),\
+    _T("309"),\
+    _T("310"),\
+    _T("311"),\
+    _T("312"),\
+    _T("313"),\
+    _T("314"),\
+    _T("315"),\
+    _T("316"),\
+    _T("317"),\
+    _T("318"),\
+    _T("319"),\
+    _T("320"),\
+    _T("321"),\
+    _T("322"),\
+    _T("323"),\
+    _T("324"),\
+    _T("325"),\
+    _T("326"),\
+    _T("327"),\
+    _T("328"),\
+    _T("329"),\
+    _T("330"),\
+    _T("331"),\
+    _T("332"),\
+    _T("333"),\
+    _T("334"),\
+    _T("335"),\
+    _T("336"),\
+    _T("337"),\
+    _T("338"),\
+    _T("339"),\
+    _T("340"),\
+    _T("341"),\
+    _T("342"),\
+    _T("343"),\
+    _T("344"),\
+    _T("345"),\
+    _T("346"),\
+    _T("347"),\
+    _T("348"),\
+    _T("349"),\
+    _T("350"),\
+    _T("351"),\
+    _T("352"),\
+    _T("353"),\
+    _T("354"),\
+    _T("355"),\
+    _T("356"),\
+    _T("357"),\
+    _T("358"),\
+    _T("359"),\
+    _T("360"),\
+    _T("361"),\
+    _T("362"),\
+    _T("363"),\
+    _T("364"),\
+    _T("365"),\
+    _T("366"),\
+    _T("367"),\
+    _T("368"),\
+    _T("369"),\
+    _T("370"),\
+    _T("371"),\
+    _T("372"),\
+    _T("373"),\
+    _T("374"),\
+    _T("375"),\
+    _T("376"),\
+    _T("377"),\
+    _T("378"),\
+    _T("379"),\
+    _T("380"),\
+    _T("381"),\
+    _T("382"),\
+    _T("383"),\
+    _T("384"),\
+    _T("385"),\
+    _T("386"),\
+    _T("387"),\
+    _T("388"),\
+    _T("389"),\
+    _T("390"),\
+    _T("391"),\
+    _T("392"),\
+    _T("393"),\
+    _T("394"),\
+    _T("395"),\
+    _T("396"),\
+    _T("397"),\
+    _T("398"),\
+    _T("399"),\
+    _T("400"),\
+    _T("401"),\
+    _T("402"),\
+    _T("403"),\
+    _T("404"),\
+    _T("405"),\
+    _T("406"),\
+    _T("407"),\
+    _T("408"),\
+    _T("409"),\
+    _T("410"),\
+    _T("411"),\
+    _T("412"),\
+    _T("413"),\
+    _T("414"),\
+    _T("415"),\
+    _T("416"),\
+    _T("417"),\
+    _T("418"),\
+    _T("419"),\
+    _T("420"),\
+    _T("421"),\
+    _T("422"),\
+    _T("423"),\
+    _T("424"),\
+    _T("425"),\
+    _T("426"),\
+    _T("427"),\
+    _T("428"),\
+    _T("429"),\
+    _T("430"),\
+    _T("431"),\
+    _T("432"),\
+    _T("433"),\
+    _T("434"),\
+    _T("435"),\
+    _T("436"),\
+    _T("437"),\
+    _T("438"),\
+    _T("439"),\
+    _T("440"),\
+    _T("441"),\
+    _T("442"),\
+    _T("443"),\
+    _T("444"),\
+    _T("445"),\
+    _T("446"),\
+    _T("447"),\
+    _T("448"),\
+    _T("449"),\
+    _T("450"),\
+    _T("451"),\
+    _T("452"),\
+    _T("453"),\
+    _T("454"),\
+    _T("455"),\
+    _T("456"),\
+    _T("457"),\
+    _T("458"),\
+    _T("459"),\
+    _T("460"),\
+    _T("461"),\
+    _T("462"),\
+    _T("463"),\
+    _T("464"),\
+    _T("465"),\
+    _T("466"),\
+    _T("467"),\
+    _T("468"),\
+    _T("469"),\
+    _T("470"),\
+    _T("471"),\
+    _T("472"),\
+    _T("473"),\
+    _T("474"),\
+    _T("475"),\
+    _T("476"),\
+    _T("477"),\
+    _T("478"),\
+    _T("479"),\
+    _T("480"),\
+    _T("481"),\
+    _T("482"),\
+    _T("483"),\
+    _T("484"),\
+    _T("485"),\
+    _T("486"),\
+    _T("487"),\
+    _T("488"),\
+    _T("489"),\
+    _T("490"),\
+    _T("491"),\
+    _T("492"),\
+    _T("493"),\
+    _T("494"),\
+    _T("495"),\
+    _T("496"),\
+    _T("497"),\
+    _T("498"),\
+    _T("499"),\
+    _T("500"),\
+    _T("501"),\
+    _T("502"),\
+    _T("503"),\
+    _T("504"),\
+    _T("505"),\
+    _T("506"),\
+    _T("507"),\
+    _T("508"),\
+    _T("509"),\
+    _T("510"),\
+    _T("511"),\
+    _T("512"),\
+    _T("513"),\
+    _T("514"),\
+    _T("515"),\
+    _T("516"),\
+    _T("517"),\
+    _T("518"),\
+    _T("519"),\
+    _T("520"),\
+    _T("521"),\
+    _T("522"),\
+    _T("523"),\
+    _T("524"),\
+    _T("525"),\
+    _T("526"),\
+    _T("527"),\
+    _T("528"),\
+    _T("529"),\
+    _T("530"),\
+    _T("531"),\
+    _T("532"),\
+    _T("533"),\
+    _T("534"),\
+    _T("535"),\
+    _T("536"),\
+    _T("537"),\
+    _T("538"),\
+    _T("539"),\
+    _T("540"),\
+    _T("541"),\
+    _T("542"),\
+    _T("543"),\
+    _T("544"),\
+    _T("545"),\
+    _T("546"),\
+    _T("547"),\
+    _T("548"),\
+    _T("549"),\
+    _T("550"),\
+    _T("551"),\
+    _T("552"),\
+    _T("553"),\
+    _T("554"),\
+    _T("555"),\
+    _T("556"),\
+    _T("557"),\
+    _T("558"),\
+    _T("559"),\
+    _T("560"),\
+    _T("561"),\
+    _T("562"),\
+    _T("563"),\
+    _T("564"),\
+    _T("565"),\
+    _T("566"),\
+    _T("567"),\
+    _T("568"),\
+    _T("569"),\
+    _T("570"),\
+    _T("571"),\
+    _T("572"),\
+    _T("573"),\
+    _T("574"),\
+    _T("575"),\
+    _T("576"),\
+    _T("577"),\
+    _T("578"),\
+    _T("579"),\
+    _T("580"),\
+    _T("581"),\
+    _T("582"),\
+    _T("583"),\
+    _T("584"),\
+    _T("585"),\
+    _T("586"),\
+    _T("587"),\
+    _T("588"),\
+    _T("589"),\
+    _T("590"),\
+    _T("591"),\
+    _T("592"),\
+    _T("593"),\
+    _T("594"),\
+    _T("595"),\
+    _T("596"),\
+    _T("597"),\
+    _T("598"),\
+    _T("599"),\
+    _T("600"),\
+    _T("601"),\
+    _T("602"),\
+    _T("603"),\
+    _T("604"),\
+    _T("605"),\
+    _T("606"),\
+    _T("607"),\
+    _T("608"),\
+    _T("609"),\
+    _T("610"),\
+    _T("611"),\
+    _T("612"),\
+    _T("613"),\
+    _T("614"),\
+    _T("615"),\
+    _T("616"),\
+    _T("617"),\
+    _T("618"),\
+    _T("619"),\
+    _T("620"),\
+    _T("621"),\
+    _T("622"),\
+    _T("623"),\
+    _T("624"),\
+    _T("625"),\
+    _T("626"),\
+    _T("627"),\
+    _T("628"),\
+    _T("629"),\
+    _T("630"),\
+    _T("631"),\
+    _T("632"),\
+    _T("633"),\
+    _T("634"),\
+    _T("635"),\
+    _T("636"),\
+    _T("637"),\
+    _T("638"),\
+    _T("639"),\
+    _T("640"),\
+    _T("641"),\
+    _T("642"),\
+    _T("643"),\
+    _T("644"),\
+    _T("645"),\
+    _T("646"),\
+    _T("647"),\
+    _T("648"),\
+    _T("649"),\
+    _T("650"),\
+    _T("651"),\
+    _T("652"),\
+    _T("653"),\
+    _T("654"),\
+    _T("655"),\
+    _T("656"),\
+    _T("657"),\
+    _T("658"),\
+    _T("659"),\
+    _T("660"),\
+    _T("661"),\
+    _T("662"),\
+    _T("663"),\
+    _T("664"),\
+    _T("665"),\
+    _T("666"),\
+    _T("667"),\
+    _T("668"),\
+    _T("669"),\
+    _T("670"),\
+    _T("671"),\
+    _T("672"),\
+    _T("673"),\
+    _T("674"),\
+    _T("675"),\
+    _T("676"),\
+    _T("677"),\
+    _T("678"),\
+    _T("679"),\
+    _T("680"),\
+    _T("681"),\
+    _T("682"),\
+    _T("683"),\
+    _T("684"),\
+    _T("685"),\
+    _T("686"),\
+    _T("687"),\
+    _T("688"),\
+    _T("689"),\
+    _T("690"),\
+    _T("691"),\
+    _T("692"),\
+    _T("693"),\
+    _T("694"),\
+    _T("695"),\
+    _T("696"),\
+    _T("697"),\
+    _T("698"),\
+    _T("699"),\
+    _T("700"),\
+    _T("701"),\
+    _T("702"),\
+    _T("703"),\
+    _T("704"),\
+    _T("705"),\
+    _T("706"),\
+    _T("707"),\
+    _T("708"),\
+    _T("709"),\
+    _T("710"),\
+    _T("711"),\
+    _T("712"),\
+    _T("713"),\
+    _T("714"),\
+    _T("715"),\
+    _T("716"),\
+    _T("717"),\
+    _T("718"),\
+    _T("719"),\
+    _T("720"),\
+    _T("721"),\
+    _T("722"),\
+    _T("723"),\
+    _T("724"),\
+    _T("725"),\
+    _T("726"),\
+    _T("727"),\
+    _T("728"),\
+    _T("729"),\
+    _T("730"),\
+    _T("731"),\
+    _T("732"),\
+    _T("733"),\
+    _T("734"),\
+    _T("735"),\
+    _T("736"),\
+    _T("737"),\
+    _T("738"),\
+    _T("739"),\
+    _T("740"),\
+    _T("741"),\
+    _T("742"),\
+    _T("743"),\
+    _T("744"),\
+    _T("745"),\
+    _T("746"),\
+    _T("747"),\
+    _T("748"),\
+    _T("749"),\
+    _T("750"),\
+    _T("751"),\
+    _T("752"),\
+    _T("753"),\
+    _T("754"),\
+    _T("755"),\
+    _T("756"),\
+    _T("757"),\
+    _T("758"),\
+    _T("759"),\
+    _T("760"),\
+    _T("761"),\
+    _T("762"),\
+    _T("763"),\
+    _T("764"),\
+    _T("765"),\
+    _T("766"),\
+    _T("767"),\
+    _T("768"),\
+    _T("769"),\
+    _T("770"),\
+    _T("771"),\
+    _T("772"),\
+    _T("773"),\
+    _T("774"),\
+    _T("775"),\
+    _T("776"),\
+    _T("777"),\
+    _T("778"),\
+    _T("779"),\
+    _T("780"),\
+    _T("781"),\
+    _T("782"),\
+    _T("783"),\
+    _T("784"),\
+    _T("785"),\
+    _T("786"),\
+    _T("787"),\
+    _T("788"),\
+    _T("789"),\
+    _T("790"),\
+    _T("791"),\
+    _T("792"),\
+    _T("793"),\
+    _T("794"),\
+    _T("795"),\
+    _T("796"),\
+    _T("797"),\
+    _T("798"),\
+    _T("799"),\
+    _T("800"),\
+    _T("801"),\
+    _T("802"),\
+    _T("803"),\
+    _T("804"),\
+    _T("805"),\
+    _T("806"),\
+    _T("807"),\
+    _T("808"),\
+    _T("809"),\
+    _T("810"),\
+    _T("811"),\
+    _T("812"),\
+    _T("813"),\
+    _T("814"),\
+    _T("815"),\
+    _T("816"),\
+    _T("817"),\
+    _T("818"),\
+    _T("819"),\
+    _T("820"),\
+    _T("821"),\
+    _T("822"),\
+    _T("823"),\
+    _T("824"),\
+    _T("825"),\
+    _T("826"),\
+    _T("827"),\
+    _T("828"),\
+    _T("829"),\
+    _T("830"),\
+    _T("831"),\
+    _T("832"),\
+    _T("833"),\
+    _T("834"),\
+    _T("835"),\
+    _T("836"),\
+    _T("837"),\
+    _T("838"),\
+    _T("839"),\
+    _T("840"),\
+    _T("841"),\
+    _T("842"),\
+    _T("843"),\
+    _T("844"),\
+    _T("845"),\
+    _T("846"),\
+    _T("847"),\
+    _T("848"),\
+    _T("849"),\
+    _T("850"),\
+    _T("851"),\
+    _T("852"),\
+    _T("853"),\
+    _T("854"),\
+    _T("855"),\
+    _T("856"),\
+    _T("857"),\
+    _T("858"),\
+    _T("859"),\
+    _T("860"),\
+    _T("861"),\
+    _T("862"),\
+    _T("863"),\
+    _T("864"),\
+    _T("865"),\
+    _T("866"),\
+    _T("867"),\
+    _T("868"),\
+    _T("869"),\
+    _T("870"),\
+    _T("871"),\
+    _T("872"),\
+    _T("873"),\
+    _T("874"),\
+    _T("875"),\
+    _T("876"),\
+    _T("877"),\
+    _T("878"),\
+    _T("879"),\
+    _T("880"),\
+    _T("881"),\
+    _T("882"),\
+    _T("883"),\
+    _T("884"),\
+    _T("885"),\
+    _T("886"),\
+    _T("887"),\
+    _T("888"),\
+    _T("889"),\
+    _T("890"),\
+    _T("891"),\
+    _T("892"),\
+    _T("893"),\
+    _T("894"),\
+    _T("895"),\
+    _T("896"),\
+    _T("897"),\
+    _T("898"),\
+    _T("899"),\
+    _T("900"),\
+    _T("901"),\
+    _T("902"),\
+    _T("903"),\
+    _T("904"),\
+    _T("905"),\
+    _T("906"),\
+    _T("907"),\
+    _T("908"),\
+    _T("909"),\
+    _T("910"),\
+    _T("911"),\
+    _T("912"),\
+    _T("913"),\
+    _T("914"),\
+    _T("915"),\
+    _T("916"),\
+    _T("917"),\
+    _T("918"),\
+    _T("919"),\
+    _T("920"),\
+    _T("921"),\
+    _T("922"),\
+    _T("923"),\
+    _T("924"),\
+    _T("925"),\
+    _T("926"),\
+    _T("927"),\
+    _T("928"),\
+    _T("929"),\
+    _T("930"),\
+    _T("931"),\
+    _T("932"),\
+    _T("933"),\
+    _T("934"),\
+    _T("935"),\
+    _T("936"),\
+    _T("937"),\
+    _T("938"),\
+    _T("939"),\
+    _T("940"),\
+    _T("941"),\
+    _T("942"),\
+    _T("943"),\
+    _T("944"),\
+    _T("945"),\
+    _T("946"),\
+    _T("947"),\
+    _T("948"),\
+    _T("949"),\
+    _T("950"),\
+    _T("951"),\
+    _T("952"),\
+    _T("953"),\
+    _T("954"),\
+    _T("955"),\
+    _T("956"),\
+    _T("957"),\
+    _T("958"),\
+    _T("959"),\
+    _T("960"),\
+    _T("961"),\
+    _T("962"),\
+    _T("963"),\
+    _T("964"),\
+    _T("965"),\
+    _T("966"),\
+    _T("967"),\
+    _T("968"),\
+    _T("969"),\
+    _T("970"),\
+    _T("")
+#endif // _DEBUG || _RELEASE_INTERNAL
+
+#endif // __VPKRNHEADER_H__
diff -pruN 22.4.3+ds1-1/media_common/agnostic/common/vp/media_srcs.cmake 22.5.1+ds1-1/media_common/agnostic/common/vp/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/agnostic/common/vp/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/agnostic/common/vp/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -19,3 +19,5 @@
 # OTHER DEALINGS IN THE SOFTWARE.
 
 media_include_subdirectory(hal)
+media_include_subdirectory(kernel)
+media_include_subdirectory(kdll)
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_common/linux/common/os/media_srcs.cmake 22.5.1+ds1-1/media_common/linux/common/os/media_srcs.cmake
--- 22.4.3+ds1-1/media_common/linux/common/os/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/linux/common/os/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -27,20 +27,21 @@ set(TMP_HEADERS_
 )
 
 if(${Media_Scalability_Supported} STREQUAL "yes")
-
 set(TMP_HEADERS_
     ${TMP_HEADERS_}
     ${CMAKE_CURRENT_LIST_DIR}/mos_os_virtualengine_specific.h
 )
+endif() #if(${Media_Scalability_Supported} STREQUAL "yes")
 
-endif()
+source_group( "MOS" FILES ${TMP_SOURCES_} ${TMP_HEADERS_} )
 
-set(HEADERS_
-    ${HEADERS_}
+set(SOFTLET_MOS_COMMON_HEADERS_
+    ${SOFTLET_MOS_COMMON_HEADERS_}
     ${TMP_HEADERS_}
 )
+set(SOFTLET_MOS_PUBLIC_INCLUDE_DIRS_
+    ${SOFTLET_MOS_PUBLIC_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
 
-source_group( "MOS" FILES ${TMP_SOURCES_} ${TMP_HEADERS_} )
-
-media_add_curr_to_include_path()
 endif() # CMAKE_WDDM_LINUX
diff -pruN 22.4.3+ds1-1/media_common/linux/common/os/mos_os_specific.h 22.5.1+ds1-1/media_common/linux/common/os/mos_os_specific.h
--- 22.4.3+ds1-1/media_common/linux/common/os/mos_os_specific.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/linux/common/os/mos_os_specific.h	2022-07-19 15:03:31.000000000 +0000
@@ -594,7 +594,7 @@ struct _MOS_OS_CONTEXT
 
     std::vector< struct MOS_CONTEXT_OFFSET> contextOffsetList;
 
-    bool                bSimIsActive;   //!< To indicate if simulation environment
+    bool                bSimIsActive = false;   //!< To indicate if simulation environment
     bool                m_apoMosEnabled;  //!< apo mos or not
 
     // Media memory decompression function
@@ -725,17 +725,6 @@ extern "C" {
 #endif
 
 //!
-//! \brief    Check if OS resource is nullptr
-//! \details  Check if OS resource is nullptr
-//! \param    PMOS_RESOURCE pOsResource
-//!           [in] Pointer to OS Resource
-//! \return   int32_t
-//!           Return true if nullptr, otherwise false
-//!
-int32_t Mos_ResourceIsNull(
-    PMOS_RESOURCE pOsResource);
-
-//!
 //! \brief    Get Buffer Type
 //! \details  Returns the type of buffer, 1D, 2D or volume
 //! \param    PMOS_RESOURCE pOsResource
@@ -746,17 +735,6 @@ MOS_GFXRES_TYPE GetResType(
     PMOS_RESOURCE pOsResource);
 
 //!
-//! \brief    OS reset resource
-//! \details  Resets the OS resource
-//! \param    PMOS_RESOURCE pOsResource
-//!           [in] Pointer to OS Resource
-//! \return   void
-//!           Return NONE
-//!
-void Mos_ResetResource(
-    PMOS_RESOURCE pOsResource);
-
-//!
 //! \brief    Convert to MOS tile type
 //! \details  Convert from Linux to MOS tile type
 //! \param    uint32_t type
diff -pruN 22.4.3+ds1-1/media_common/linux/common/os/mos_os_virtualengine_specific.h 22.5.1+ds1-1/media_common/linux/common/os/mos_os_virtualengine_specific.h
--- 22.4.3+ds1-1/media_common/linux/common/os/mos_os_virtualengine_specific.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/linux/common/os/mos_os_virtualengine_specific.h	2022-07-19 15:03:31.000000000 +0000
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2016-2018, Intel Corporation
+* Copyright (c) 2016-2022, Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
@@ -27,6 +27,7 @@
 
 #ifndef __MOS_OS_VIRTUALENGINE_SPECIFIC_H__
 #define __MOS_OS_VIRTUALENGINE_SPECIFIC_H__
+#include <cstdint>
 
 typedef struct _MOS_SPECIFIC_VE_HINT_PARAMS MOS_VIRTUALENGINE_HINT_PARAMS, *PMOS_VIRTUALENGINE_HINT_PARAMS;
 
diff -pruN 22.4.3+ds1-1/media_common/linux/common/os/mos_util_user_feature_keys_specific.h 22.5.1+ds1-1/media_common/linux/common/os/mos_util_user_feature_keys_specific.h
--- 22.4.3+ds1-1/media_common/linux/common/os/mos_util_user_feature_keys_specific.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_common/linux/common/os/mos_util_user_feature_keys_specific.h	2022-07-19 15:03:31.000000000 +0000
@@ -37,4 +37,7 @@
 \*--------------------------------------------------------------------------*/
 #define MEDIA_USER_SETTING_INTERNAL             0x1
 
+#define __MEDIA_USER_FEATURE_VALUE_ENABLE_SOFTPIN       "Enable Softpin"
+#define __MEDIA_USER_FEATURE_VALUE_DISABLE_KMD_WATCHDOG "Disable KMD Watchdog"
+
 #endif // __MOS_UTIL_USER_FEATURE_KEYS_SPECIFIC_H__
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_common.h 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_common.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_common.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_common.h	2022-07-19 15:03:31.000000000 +0000
@@ -295,6 +295,9 @@ typedef enum _CM_RETURN_CODE
 
 #define CM_DEVICE_CREATE_OPTION_TDR_DISABLE                 64  //Reserved, used only in CMRT Thin
 
+#define CM_DEVICE_CREATE_PRIORITY_DEFAULT                   0
+#define CM_DEVICE_CREATE_PRIORITY_REALTIME                  1
+
 #define CM_DEVICE_CREATE_OPTION_DEFAULT                     CM_DEVICE_CREATE_OPTION_SCRATCH_SPACE_ENABLE
 
 #define CM_DEVICE_CONFIG_SCRATCH_SPACE_SIZE_OFFSET          1
@@ -439,11 +442,12 @@ struct _CM_QUEUE_CREATE_OPTION
     unsigned int                  GPUContext              : 8; // user-provided GPU Context ordinal
     CM_QUEUE_SSEU_USAGE_HINT_TYPE SseuUsageHint           : 3;
     unsigned int                  Reserved1               : 1;
-    unsigned int                  Reserved2               : 12;
+    unsigned int                  IsRealTimePrioriy       : 1; // Create Context with real-time priority
+    unsigned int                  Reserved2               : 11;
 };
 #define CM_QUEUE_CREATE_OPTION _CM_QUEUE_CREATE_OPTION
 
-const CM_QUEUE_CREATE_OPTION CM_DEFAULT_QUEUE_CREATE_OPTION = { CM_QUEUE_TYPE_RENDER, false, 0, false, 0, CM_QUEUE_SSEU_USAGE_HINT_DEFAULT, 0, 0 };
+const CM_QUEUE_CREATE_OPTION CM_DEFAULT_QUEUE_CREATE_OPTION = { CM_QUEUE_TYPE_RENDER, false, 0, false, 0, CM_QUEUE_SSEU_USAGE_HINT_DEFAULT, 0, 0, 0};
 
 //------------------------------------------------------------------------------
 //|GT-PIN
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_device_rt_base.cpp 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_device_rt_base.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_device_rt_base.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_device_rt_base.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -147,7 +147,8 @@ CmDeviceRTBase::CmDeviceRTBase(uint32_t
     m_hasGpuCopyKernel(false),
     m_hasGpuInitKernel(false),
     m_kernelsLoaded(0),
-    m_preloadKernelEnabled(true)
+    m_preloadKernelEnabled(true),
+    m_queuePriority(CM_DEVICE_CREATE_PRIORITY_DEFAULT)
 {
     //Initialize the structures in the class
     MOS_ZeroMemory(&m_halMaxValues, sizeof(m_halMaxValues));
@@ -1627,6 +1628,7 @@ CM_RT_API int32_t CmDeviceRTBase::Create
 {
     INSERT_API_CALL_LOG(GetHalState());
     CM_QUEUE_CREATE_OPTION queueCreateOption = CM_DEFAULT_QUEUE_CREATE_OPTION;
+    queueCreateOption.IsRealTimePrioriy = m_queuePriority;
 
     // Check queue type redirect is needed.
     PCM_CONTEXT_DATA cmData = (PCM_CONTEXT_DATA)GetAccelData();
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_device_rt_base.h 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_device_rt_base.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_device_rt_base.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_device_rt_base.h	2022-07-19 15:03:31.000000000 +0000
@@ -631,6 +631,8 @@ protected:
 
     bool           m_preloadKernelEnabled;
 
+    uint8_t        m_queuePriority;
+
     static const uint32_t m_maxPrintBuffer;
 private:
     CmDeviceRTBase(const CmDeviceRTBase& other);
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_hal.cpp 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_hal.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_hal.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_hal.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -2695,7 +2695,8 @@ MOS_STATUS HalCm_GetSamplerOffset(
     PMHW_SAMPLER_STATE_PARAM samplerParam,
     uint32_t                *pdwSamplerOffset)
 {
-    unsigned int tmpSamplerOffset = renderHal->pStateHeap->pCurMediaState->pDynamicState->Sampler3D.dwOffset +
+    PRENDERHAL_MEDIA_STATE_LEGACY pCurMediaStateLegacy = (PRENDERHAL_MEDIA_STATE_LEGACY)renderHal->pStateHeap->pCurMediaState;
+    unsigned int tmpSamplerOffset = pCurMediaStateLegacy->pDynamicState->Sampler3D.dwOffset +
                                   state->taskParam->samplerOffsetsByKernel[mediaID] +
                                   samplerOffset;
 
@@ -2706,7 +2707,7 @@ MOS_STATUS HalCm_GetSamplerOffset(
 
     if (samplerParam->SamplerType == MHW_SAMPLER_TYPE_3D)
     {
-        samplerParam->Unorm.IndirectStateOffset = MOS_ALIGN_CEIL( renderHal->pStateHeap->pCurMediaState->pDynamicState->Sampler3D.dwOffset +
+        samplerParam->Unorm.IndirectStateOffset = MOS_ALIGN_CEIL( pCurMediaStateLegacy->pDynamicState->Sampler3D.dwOffset +
                                                                   state->taskParam->samplerIndirectOffsetsByKernel[mediaID] +
                                                                   samplerBTI * renderHal->pHwSizes->dwSizeSamplerIndirectState,
                                                                   1 << MHW_SAMPLER_INDIRECT_SHIFT);
@@ -2745,18 +2746,19 @@ MOS_STATUS HalCm_SetupInterfaceDescripto
     PRENDERHAL_STATE_HEAP    stateHeap;
     PRENDERHAL_DYNAMIC_STATE dynamicState;
     unsigned long            mediaStateOffset;
-
+    
+    PRENDERHAL_MEDIA_STATE_LEGACY mediaStateLegacy = (PRENDERHAL_MEDIA_STATE_LEGACY)mediaState;
     //-----------------------------------------
     MHW_RENDERHAL_CHK_NULL(renderHal);
     MHW_RENDERHAL_CHK_NULL(renderHal->pMhwStateHeap);
-    MHW_RENDERHAL_CHK_NULL(mediaState);
-    MHW_RENDERHAL_CHK_NULL(mediaState->pDynamicState);
+    MHW_RENDERHAL_CHK_NULL(mediaStateLegacy);
+    MHW_RENDERHAL_CHK_NULL(mediaStateLegacy->pDynamicState);
     MHW_RENDERHAL_CHK_NULL(interfaceDescriptorParams);
     //-----------------------------------------
 
     // Get states, params
     stateHeap = renderHal->pStateHeap;
-    dynamicState = mediaState->pDynamicState;
+    dynamicState = mediaStateLegacy->pDynamicState;
     mediaStateOffset = dynamicState->memoryBlock.GetOffset();
 
     params.dwMediaIdOffset = mediaStateOffset + dynamicState->MediaID.dwOffset;
@@ -2820,16 +2822,16 @@ int32_t HalCm_AllocateMediaID(
     int32_t                    bindingTableID,
     int32_t                    curbeOffset)
 {
-    PRENDERHAL_INTERFACE    renderHal = state->renderHal;
-    PRENDERHAL_MEDIA_STATE  curMediaState;
-    int32_t                 curbeSize, iCurbeCurrent;
-    int32_t                 interfaceDescriptor;
+    PRENDERHAL_INTERFACE            renderHal = state->renderHal;
+    PRENDERHAL_MEDIA_STATE_LEGACY   curMediaState;
+    int32_t                         curbeSize, iCurbeCurrent;
+    int32_t                         interfaceDescriptor;
     RENDERHAL_INTERFACE_DESCRIPTOR_PARAMS interfaceDescriptorParams;
 
     interfaceDescriptor = -1;
 
     // Obtain pointer and validate current media state
-    curMediaState = renderHal->pStateHeap->pCurMediaState;
+    curMediaState = (PRENDERHAL_MEDIA_STATE_LEGACY)renderHal->pStateHeap->pCurMediaState;
 
     if (state->dshEnabled)
     {
@@ -3471,7 +3473,7 @@ MOS_STATUS HalCm_SetupSamplerState(
     }
     CM_CHK_MOSSTATUS_GOTOFINISH(renderHal->pMhwStateHeap->AddSamplerStateData(
         samplerOffset, 
-        &(renderHal->pStateHeap->pCurMediaState->pDynamicState->memoryBlock), 
+        &(((PRENDERHAL_MEDIA_STATE_LEGACY)renderHal->pStateHeap->pCurMediaState)->pDynamicState->memoryBlock), 
         samplerParam));
 
     state->samplerIndexTable[index] = (unsigned char)samplerIndex;
@@ -3561,7 +3563,7 @@ MOS_STATUS HalCm_SetupSamplerStateWithBT
 
     CM_CHK_MOSSTATUS_GOTOFINISH(renderHal->pMhwStateHeap->AddSamplerStateData(
         samplerOffset,
-        &(renderHal->pStateHeap->pCurMediaState->pDynamicState->memoryBlock),
+        &(((PRENDERHAL_MEDIA_STATE_LEGACY)renderHal->pStateHeap->pCurMediaState)->pDynamicState->memoryBlock),
         samplerParam));
 
 finish:
@@ -7530,6 +7532,7 @@ MOS_STATUS HalCm_SetupStatesForKernelIni
 
     bool                            vmeUsed = false;
     CM_PLATFORM_INFO                platformInfo;
+    PRENDERHAL_MEDIA_STATE_LEGACY   mediaStateLegacy = (PRENDERHAL_MEDIA_STATE_LEGACY)mediaState;
 
     localIdIndex = kernelParam->localIdIndex;
 
@@ -7578,11 +7581,11 @@ MOS_STATUS HalCm_SetupStatesForKernelIni
         // Update Curbe offset after curbe load command
         if (state->dshEnabled)
         {
-            mediaState->pDynamicState->Curbe.iCurrent += MOS_ALIGN_CEIL(kernelParam->totalCurbeSize, state->renderHal->dwCurbeBlockAlign);
+            mediaStateLegacy->pDynamicState->Curbe.iCurrent += MOS_ALIGN_CEIL(kernelParam->totalCurbeSize, state->renderHal->dwCurbeBlockAlign);
         }
         else
         {
-            mediaState->iCurbeOffset += MOS_ALIGN_CEIL(kernelParam->totalCurbeSize, state->renderHal->dwCurbeBlockAlign);
+            mediaStateLegacy->iCurbeOffset += MOS_ALIGN_CEIL(kernelParam->totalCurbeSize, state->renderHal->dwCurbeBlockAlign);
         }
     }
 
@@ -7801,7 +7804,8 @@ MOS_STATUS HalCm_SetupStatesForKernelIni
             // tell pfnLoadCurbeData the current curbe offset
             if (state->dshEnabled)
             {
-                PRENDERHAL_DYNAMIC_STATE dynamicState = stateHeap->pCurMediaState->pDynamicState;
+                PRENDERHAL_MEDIA_STATE_LEGACY pCurMediaStateLegacy = (PRENDERHAL_MEDIA_STATE_LEGACY)stateHeap->pCurMediaState;
+                PRENDERHAL_DYNAMIC_STATE dynamicState = pCurMediaStateLegacy->pDynamicState;
                 dynamicState->Curbe.iCurrent -= MOS_ALIGN_CEIL(kernelParam->totalCurbeSize, state->renderHal->dwCurbeBlockAlign);
                 kernelParam->curbeOffset = dynamicState->Curbe.iCurrent;
             }
@@ -7823,7 +7827,8 @@ MOS_STATUS HalCm_SetupStatesForKernelIni
             // tell pfnLoadCurbeData the current curbe offset
             if (state->dshEnabled)
             {
-                PRENDERHAL_DYNAMIC_STATE dynamicState = stateHeap->pCurMediaState->pDynamicState;
+                PRENDERHAL_MEDIA_STATE_LEGACY pCurMediaStateLegacy = (PRENDERHAL_MEDIA_STATE_LEGACY)stateHeap->pCurMediaState;
+                PRENDERHAL_DYNAMIC_STATE dynamicState = pCurMediaStateLegacy->pDynamicState;
                 dynamicState->Curbe.iCurrent -= MOS_ALIGN_CEIL(kernelParam->totalCurbeSize, state->renderHal->dwCurbeBlockAlign);
                 kernelParam->curbeOffset = dynamicState->Curbe.iCurrent;
             }
@@ -7903,14 +7908,14 @@ MOS_STATUS HalCm_SetConditionalEndInfo(
 MOS_STATUS HalCm_Allocate(
     PCM_HAL_STATE state)                                                       // [in] Pointer to CM State
 {
-    MOS_STATUS              eStatus;
-    PCM_HAL_DEVICE_PARAM    deviceParam;
-    PRENDERHAL_INTERFACE     renderHal;
+    MOS_STATUS                     eStatus;
+    PCM_HAL_DEVICE_PARAM           deviceParam;
+    PRENDERHAL_INTERFACE           renderHal;
     PRENDERHAL_STATE_HEAP_SETTINGS stateHeapSettings;
-    uint32_t                i;
-    MOS_NULL_RENDERING_FLAGS nullHWAccelerationEnable;
-    RENDERHAL_SETTINGS       renderHalSettings;
-    uint32_t                maxTasks;
+    uint32_t                       i;
+    MOS_NULL_RENDERING_FLAGS       nullHWAccelerationEnable;
+    RENDERHAL_SETTINGS_LEGACY      renderHalSettings;
+    uint32_t                       maxTasks;
 
     PMHW_BATCH_BUFFER        batchBuffer = nullptr;
 
@@ -10501,8 +10506,8 @@ MOS_STATUS HalCm_Create(
         &createOption));
 
     // Allocate/Initialize CM Rendering Interface
-    state->renderHal = (PRENDERHAL_INTERFACE)
-                                MOS_AllocAndZeroMemory(sizeof(RENDERHAL_INTERFACE));
+    state->renderHal = (PRENDERHAL_INTERFACE_LEGACY)
+                                MOS_AllocAndZeroMemory(sizeof(RENDERHAL_INTERFACE_LEGACY));
     CM_CHK_NULL_GOTOFINISH_MOSERROR(state->renderHal);
 
     state->dshEnabled                   = param->dynamicStateHeap;
@@ -10514,7 +10519,7 @@ MOS_STATUS HalCm_Create(
     }
     else
     {
-        CM_CHK_MOSSTATUS_GOTOFINISH(RenderHal_InitInterface(state->renderHal, &state->cpInterface, state->osInterface));
+        CM_CHK_MOSSTATUS_GOTOFINISH(RenderHal_InitInterface_Legacy(state->renderHal, &state->cpInterface, state->osInterface));
     }
 
     // Allocate/Initialize VEBOX Interface
@@ -11011,7 +11016,7 @@ MOS_STATUS HalCm_GetSurfaceDetails(
     surfaceInfos  = taskParam->surfEntryInfoArrays.surfEntryInfosArray[curKernelIndex].surfEntryInfos;
     pgSurfaceInfos = taskParam->surfEntryInfoArrays.surfEntryInfosArray[curKernelIndex].globalSurfInfos;
 
-    tempOsFormat   = cmState->osInterface->pfnFmt_MosToOs(surface.Format);
+    tempOsFormat = (MOS_OS_FORMAT)MosInterface::MosFmtToOsFmt(surface.Format);
 
     switch (argKind)
     {
@@ -11884,9 +11889,9 @@ MOS_STATUS HalCm_SendMediaWalkerState(
     PCM_HAL_KERNEL_PARAM        kernelParam,
     PMOS_COMMAND_BUFFER         cmdBuffer)
 {
-    PRENDERHAL_INTERFACE      renderHal;
-    MHW_WALKER_PARAMS         mediaWalkerParams;
-    MOS_STATUS                eStatus;
+    PRENDERHAL_INTERFACE_LEGACY     renderHal;
+    MHW_WALKER_PARAMS               mediaWalkerParams;
+    MOS_STATUS                      eStatus;
 
     eStatus         = MOS_STATUS_SUCCESS;
     renderHal = state->renderHal;
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_hal_dump.cpp 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_hal_dump.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_hal_dump.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_hal_dump.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -350,13 +350,14 @@ int32_t HalCm_DumpCurbeData(PCM_HAL_STAT
     // write curbe data dwords.
     if (state->dshEnabled)
     {
-        numberOfDwords = stateHeap->pCurMediaState->pDynamicState->Curbe.dwSize / sizeof(uint32_t);
+        PRENDERHAL_MEDIA_STATE_LEGACY pCurMediaStateLegacy = (PRENDERHAL_MEDIA_STATE_LEGACY)stateHeap->pCurMediaState;
+        numberOfDwords = pCurMediaStateLegacy->pDynamicState->Curbe.dwSize / sizeof(uint32_t);
         sizeToAllocate = numberOfDwords*SIZE_OF_DWORD_PLUS_ONE+2;
         outputBuffer = (char *)MOS_AllocAndZeroMemory(sizeToAllocate);
-        curbeData = (uint32_t *)MOS_AllocAndZeroMemory(stateHeap->pCurMediaState->pDynamicState->Curbe.dwSize);
-        stateHeap->pCurMediaState->pDynamicState->memoryBlock.ReadData(curbeData,
-            stateHeap->pCurMediaState->pDynamicState->Curbe.dwOffset,
-            stateHeap->pCurMediaState->pDynamicState->Curbe.dwSize);
+        curbeData = (uint32_t *)MOS_AllocAndZeroMemory(pCurMediaStateLegacy->pDynamicState->Curbe.dwSize);
+        pCurMediaStateLegacy->pDynamicState->memoryBlock.ReadData(curbeData,
+            pCurMediaStateLegacy->pDynamicState->Curbe.dwOffset,
+            pCurMediaStateLegacy->pDynamicState->Curbe.dwSize);
 
         bytesWritten += HalCm_CopyHexDwordLine(outputBuffer,
                           sizeToAllocate - bytesWritten,
@@ -667,13 +668,14 @@ int32_t HalCm_DumpInterfaceDescriptorDat
     // write interface descriptor data dwords.
     if (state->dshEnabled)
     {
-        numberOfDwords = stateHeap->pCurMediaState->pDynamicState->MediaID.dwSize / sizeof(uint32_t);
+        PRENDERHAL_MEDIA_STATE_LEGACY pCurMediaStateLegacy = (PRENDERHAL_MEDIA_STATE_LEGACY)stateHeap->pCurMediaState;
+        numberOfDwords = pCurMediaStateLegacy->pDynamicState->MediaID.dwSize / sizeof(uint32_t);
         sizeToAllocate = numberOfDwords * SIZE_OF_DWORD_PLUS_ONE + 2;
         outputBuffer = (char *)MOS_AllocAndZeroMemory(sizeToAllocate);
-        InterfaceDescriptorData = (uint32_t *)MOS_AllocAndZeroMemory(stateHeap->pCurMediaState->pDynamicState->MediaID.dwSize);
-        stateHeap->pCurMediaState->pDynamicState->memoryBlock.ReadData(InterfaceDescriptorData,
-            stateHeap->pCurMediaState->pDynamicState->MediaID.dwOffset,
-            stateHeap->pCurMediaState->pDynamicState->MediaID.dwSize);
+        InterfaceDescriptorData = (uint32_t *)MOS_AllocAndZeroMemory(pCurMediaStateLegacy->pDynamicState->MediaID.dwSize);
+        pCurMediaStateLegacy->pDynamicState->memoryBlock.ReadData(InterfaceDescriptorData,
+            pCurMediaStateLegacy->pDynamicState->MediaID.dwOffset,
+            pCurMediaStateLegacy->pDynamicState->MediaID.dwSize);
 
         bytesWritten += HalCm_CopyHexDwordLine(outputBuffer,
             sizeToAllocate - bytesWritten,
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_hal.h 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_hal.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_hal.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_hal.h	2022-07-19 15:03:31.000000000 +0000
@@ -26,7 +26,7 @@
 #ifndef __CM_HAL_H__
 #define __CM_HAL_H__
 
-#include "renderhal.h"
+#include "renderhal_legacy.h"
 #include "cm_common.h"
 #include "cm_debug.h"
 #include "cm_csync.h"
@@ -1482,7 +1482,7 @@ typedef struct _CM_HAL_STATE
     MEDIA_FEATURE_TABLE         *skuTable;
     MEDIA_WA_TABLE              *waTable;
     PMOS_INTERFACE              osInterface;                                   // OS Interface                                 [*]
-    PRENDERHAL_INTERFACE        renderHal;                                     // Render Engine Interface                      [*]
+    PRENDERHAL_INTERFACE_LEGACY renderHal;                                     // Render Engine Interface                      [*]
     MhwVeboxInterface           *veboxInterface;                               // Vebox Interface
     MhwCpInterface*             cpInterface;                                   // Cp  Interface
     PMHW_BATCH_BUFFER           batchBuffers;                                  // Array of Batch Buffers                       [*]
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_hal_vebox.h 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_hal_vebox.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_hal_vebox.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_hal_vebox.h	2022-07-19 15:03:31.000000000 +0000
@@ -28,7 +28,7 @@
 #define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMHALVEBOX_H_
 
 #include "mos_os.h"
-#include "renderhal.h"
+#include "renderhal_legacy.h"
 #include "mhw_vebox.h"
 
 struct CM_VEBOX_SURFACE
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_queue_rt.cpp 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_queue_rt.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_queue_rt.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_queue_rt.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -264,26 +264,31 @@ int32_t CmQueueRT::Initialize()
                 }
 
 #if (_DEBUG || _RELEASE_INTERNAL)
-                MOS_USER_FEATURE_VALUE_DATA UserFeatureData = {0};
-                MOS_UserFeature_ReadValue_ID(
-                    nullptr,
-                    __MEDIA_USER_FEATURE_VALUE_SSEU_SETTING_OVERRIDE_ID,
-                    &UserFeatureData, cmHalState->osInterface->pOsContext);
-
-                // +---------------+----------------+----------------+----------------+
-                // |   EUCountMax  |   EUCountMin   |     SSCount    |   SliceCount   |
-                // +-------------24+--------------16+---------------8+---------------0+
-                if (UserFeatureData.u32Data != 0xDEADC0DE)
                 {
-                    ctxCreateOption.packed.SliceCount            = UserFeatureData.u32Data         & 0xFF;       // Bits 0-7
-                    ctxCreateOption.packed.SubSliceCount         = (UserFeatureData.u32Data >>  8) & 0xFF;       // Bits 8-15
-                    ctxCreateOption.packed.MaxEUcountPerSubSlice = (UserFeatureData.u32Data >> 16) & 0xFF;       // Bits 16-23
-                    ctxCreateOption.packed.MinEUcountPerSubSlice = (UserFeatureData.u32Data >> 24) & 0xFF;       // Bits 24-31
+                    MediaUserSettingSharedPtr   userSettingPtr = cmHalState->osInterface->pfnGetUserSettingInstance(cmHalState->osInterface);
+                    uint32_t                    value          = 0;
+                    ReadUserSettingForDebug(
+                        userSettingPtr,
+                        value,
+                        __MEDIA_USER_FEATURE_VALUE_SSEU_SETTING_OVERRIDE,
+                        MediaUserSetting::Group::Device);
+
+                    // +---------------+----------------+----------------+----------------+
+                    // |   EUCountMax  |   EUCountMin   |     SSCount    |   SliceCount   |
+                    // +-------------24+--------------16+---------------8+---------------0+
+                    if (value != 0xDEADC0DE)
+                    {
+                        ctxCreateOption.packed.SliceCount            = value         & 0xFF;       // Bits 0-7
+                        ctxCreateOption.packed.SubSliceCount         = (value >>  8) & 0xFF;       // Bits 8-15
+                        ctxCreateOption.packed.MaxEUcountPerSubSlice = (value >> 16) & 0xFF;       // Bits 16-23
+                        ctxCreateOption.packed.MinEUcountPerSubSlice = (value >> 24) & 0xFF;       // Bits 24-31
+                    }
                 }
 #endif
             }
 
             ctxCreateOption.RAMode = m_queueOption.RAMode;
+            ctxCreateOption.isRealTimePriority = m_queueOption.IsRealTimePrioriy;
 
             // Create render GPU context.
             CM_CHK_MOSSTATUS_GOTOFINISH_CMERROR(
@@ -321,6 +326,8 @@ int32_t CmQueueRT::Initialize()
                 m_usingVirtualEngine = true;
             }
 
+            ctxCreateOption.isRealTimePriority = m_queueOption.IsRealTimePrioriy;
+
             CM_CHK_MOSSTATUS_GOTOFINISH_CMERROR(
                 CreateGpuContext(cmHalState, MOS_GPU_CONTEXT_CM_COMPUTE,
                                  MOS_GPU_NODE_COMPUTE, &ctxCreateOption));
@@ -897,6 +904,11 @@ CM_RT_API int32_t CmQueueRT::EnqueueWith
     }
 
     CmTaskRT *taskRT = static_cast<CmTaskRT *>(task);
+    if(taskRT == nullptr)
+    {
+        CM_ASSERTMESSAGE("Error: Kernel array is NULL.");
+        return CM_NULL_POINTER;
+    }
     uint32_t count = 0;
     count = taskRT->GetKernelCount();
 
@@ -2586,8 +2598,8 @@ int32_t CmQueueRT::QueryFlushedTasks()
                 PCM_CONTEXT_DATA cmData = (PCM_CONTEXT_DATA)m_device->GetAccelData();
 
                 // Clear task status table in Cm Hal State
-                int32_t taskId;
-                CmEventRT*pTopTaskEvent;
+                int32_t taskId = 0;
+                CmEventRT*pTopTaskEvent = nullptr;
                 task->GetTaskEvent(pTopTaskEvent);
                 CM_CHK_NULL_GOTOFINISH_CMERROR(pTopTaskEvent);
 
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_rt_umd.h 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_rt_umd.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_rt_umd.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_rt_umd.h	2022-07-19 15:03:31.000000000 +0000
@@ -65,6 +65,28 @@ CM_RT_API int32_t CreateCmDevice(MOS_CON
                                  uint32_t devCreateOption);
 
 //!
+//! \brief    Creates a CmDevice from a MOS context.
+//! \details  If an existing CmDevice has already associated to the MOS context,
+//!           the existing CmDevice will be returned. Otherwise, a new CmDevice
+//!           instance will be created and associatied with that MOS context.
+//! \param    mosContext
+//!           [in] pointer to MOS conetext.
+//! \param    device
+//!           [in,out] reference to the pointer to the CmDevice.
+//! \param    devCreateOption
+//!           [in] option to customize CmDevice.
+//! \param    priority
+//!           [in] priority for queue.
+//! \retval   CM_SUCCESS if the CmDevice is successfully created.
+//! \retval   CM_NULL_POINTER if pMosContext is null.
+//! \retval   CM_FAILURE otherwise.
+//!
+CM_RT_API int32_t CreateCmDevice(MOS_CONTEXT *mosContext,
+                                 CmDevice *&  device,
+                                 uint32_t devCreateOption,
+                                 uint8_t  priority);
+
+//!
 //! \brief    Destroys the CmDevice. 
 //! \details  This function also destroys surfaces, kernels, programs, samplers,
 //!           threadspaces, tasks and the queues that were created using this
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_surface_manager_base.cpp 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_surface_manager_base.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_surface_manager_base.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_surface_manager_base.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -2444,6 +2444,7 @@ bool CMRT_UMD::CmSurfaceManagerBase::IsS
         case CM_SURFACE_FORMAT_A16B16G16R16F:
         case CM_SURFACE_FORMAT_A8:
         case CM_SURFACE_FORMAT_A8R8G8B8:
+        case CM_SURFACE_FORMAT_A8B8G8R8:
         case CM_SURFACE_FORMAT_YUY2:
         case CM_SURFACE_FORMAT_R32F:
         case CM_SURFACE_FORMAT_R32_UINT:
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_surface_state.cpp 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_surface_state.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_surface_state.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_surface_state.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -1057,7 +1057,7 @@ int CmSurfaceState2Dor3D::GetPlaneDefini
         case Format_Y210:
         case Format_Y216:
         {
-            RENDERHAL_PLANE_DEFINITION temp;
+            RENDERHAL_PLANE_DEFINITION temp = RENDERHAL_PLANES_DEFINITION_COUNT;
             m_renderhal->pRenderHalPltInterface->GetPlaneDefForFormatY216(
                 isRenderOutTarget,
                 m_renderhal,
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_visa.cpp 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_visa.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/cm_visa.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/cm_visa.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -27,6 +27,7 @@
 #include "cm_visa.h"
 #include "cm_def_os.h"
 #include <fstream>
+#include "mos_utilities.h"
 
 using namespace vISA;
 
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/cm/media_srcs.cmake 22.5.1+ds1-1/media_driver/agnostic/common/cm/media_srcs.cmake
--- 22.4.3+ds1-1/media_driver/agnostic/common/cm/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/cm/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2017, Intel Corporation
+# Copyright (c) 2017-2022, Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -137,14 +137,6 @@ set(TMP_HEADERS_
     ${CMAKE_CURRENT_LIST_DIR}/cm_wrapper.h
     ${CMAKE_CURRENT_LIST_DIR}/cm_surface_2d_rt_base.h)
 
-set(SOURCES_
-    ${SOURCES_}
-    ${TMP_SOURCES_})
-
-set(HEADERS_
-    ${HEADERS_}
-    ${TMP_HEADERS_})
-
 set(COMMON_SOURCES_
     ${COMMON_SOURCES_}
     ${TMP_SOURCES_})
@@ -153,9 +145,14 @@ set(COMMON_HEADERS_
     ${COMMON_HEADERS_}
     ${TMP_HEADERS_})
 
+set(COMMON_PRIVATE_INCLUDE_DIRS_
+    ${COMMON_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
+
 set(SOURCES_SSE2
     ${CMAKE_CURRENT_LIST_DIR}/cm_mem_sse2_impl.cpp)
 
 source_group(CM FILES ${TMP_SOURCES_} ${TMP_HEADERS_})
 
-media_add_curr_to_include_path()
+media_add_curr_to_include_path()
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -388,6 +388,35 @@ MOS_STATUS CodechalDecodeAvc::SetAndAllo
     return eStatus;
 }
 
+
+MOS_STATUS CodechalDecodeAvc::SetAndAllocateDmvBufferIndexMismatched(
+    uint8_t             frameIdx,
+    uint32_t            avcDmvBufferSize,
+    uint8_t            *dmvIdx,
+    MOS_RESOURCE       *avcDmvBuffers)
+{
+    MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
+
+    CODECHAL_DECODE_CHK_NULL_RETURN(dmvIdx);
+    CODECHAL_DECODE_CHK_NULL_RETURN(avcDmvBuffers);
+
+    uint8_t index = frameIdx;
+
+    if (Mos_ResourceIsNull(&avcDmvBuffers[index]))
+    {
+        // Allocate DMV buffer if it has not been allocated already.
+        CODECHAL_DECODE_CHK_STATUS_MESSAGE_RETURN(AllocateBuffer(
+                                                      &avcDmvBuffers[index],
+                                                      avcDmvBufferSize,
+                                                      "MvBuffer",
+                                                      true),
+            "Failed to allocate MV Buffer.");
+    }
+
+    *dmvIdx = index;
+    return eStatus;
+}
+
 MOS_STATUS CodechalDecodeAvc::InitMvcDummyDmvBuffer(
     uint32_t                    *mvcWaDummyDmvBuf,
     uint32_t                    size,
@@ -516,14 +545,28 @@ MOS_STATUS CodechalDecodeAvc::SetPicture
     // Override reference list with ref surface passed from DDI
     uint8_t surfCount = 0;
     uint8_t surfIndex = 0;
-    while (surfCount < m_refSurfaceNum && surfIndex < CODEC_AVC_NUM_UNCOMPRESSED_SURFACE)
+    if (m_osInterface->pfnIsMismatchOrderProgrammingSupported())
     {
-        if (!Mos_ResourceIsNull(&m_refFrameSurface[surfIndex].OsResource))
+        while (surfIndex < CODEC_AVC_NUM_UNCOMPRESSED_SURFACE)
         {
-            m_avcRefList[surfIndex]->resRefPic = m_refFrameSurface[surfIndex].OsResource;
-            surfCount++;
+            if (!Mos_ResourceIsNull(&m_refFrameSurface[surfIndex].OsResource))
+            {
+                m_avcRefList[surfIndex]->resRefPic = m_refFrameSurface[surfIndex].OsResource;
+            }
+            surfIndex++;
+        }
+    }
+    else
+    {
+        while (surfCount < m_refSurfaceNum && surfIndex < CODEC_AVC_NUM_UNCOMPRESSED_SURFACE)
+        {
+            if (!Mos_ResourceIsNull(&m_refFrameSurface[surfIndex].OsResource))
+            {
+                m_avcRefList[surfIndex]->resRefPic = m_refFrameSurface[surfIndex].OsResource;
+                surfCount++;
+            }
+            surfIndex++;
         }
-        surfIndex++;
     }
 
     uint8_t index, duplicatedIdx;
@@ -600,19 +643,50 @@ MOS_STATUS CodechalDecodeAvc::SetPicture
 
     if (!m_isSecondField)
     {
-        CODECHAL_DECODE_CHK_STATUS_RETURN(SetAndAllocateDmvBufferIndex(
-            &m_avcDmvList[0],
-            (bool)picParams->pic_fields.reference_pic_flag,
-            currPic.FrameIdx,
-            m_avcDmvBufferSize,
-            &m_avcMvBufferIndex,
-            m_resAvcDmvBuffers));
-
-        dmvidx = m_avcMvBufferIndex;
-
-        //first and second field will use the same DMV buffer in field mode
-        m_avcRefList[currPic.FrameIdx]->ucDMVIdx[0] = dmvidx;
-        m_avcRefList[currPic.FrameIdx]->ucDMVIdx[1] = dmvidx;
+        if (m_osInterface->pfnIsMismatchOrderProgrammingSupported())
+        {
+            for (i = 0; i < CODEC_AVC_MAX_NUM_REF_FRAME; i++)
+            {
+                auto frameIdx = picParams->RefFrameList[i].FrameIdx;
+                if (frameIdx != CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC)
+                {
+                    CODECHAL_DECODE_CHK_STATUS_RETURN(SetAndAllocateDmvBufferIndexMismatched(
+                        frameIdx,
+                        m_avcDmvBufferSize,
+                        &m_avcMvBufferIndex,
+                        m_resAvcDmvBuffers));
+                    dmvidx = m_avcMvBufferIndex;
+                    m_avcRefList[frameIdx]->ucDMVIdx[0] = dmvidx;
+                    m_avcRefList[frameIdx]->ucDMVIdx[1] = dmvidx;
+                }
+            }
+            CODECHAL_DECODE_CHK_STATUS_RETURN(SetAndAllocateDmvBufferIndexMismatched(
+                currPic.FrameIdx,
+                m_avcDmvBufferSize,
+                &m_avcMvBufferIndex,
+                m_resAvcDmvBuffers));
+            dmvidx = m_avcMvBufferIndex;
+
+            //first and second field will use the same DMV buffer in field mode
+            m_avcRefList[currPic.FrameIdx]->ucDMVIdx[0] = dmvidx;
+            m_avcRefList[currPic.FrameIdx]->ucDMVIdx[1] = dmvidx;
+        }
+        else
+        {
+            CODECHAL_DECODE_CHK_STATUS_RETURN(SetAndAllocateDmvBufferIndex(
+                &m_avcDmvList[0],
+                (bool)picParams->pic_fields.reference_pic_flag,
+                currPic.FrameIdx,
+                m_avcDmvBufferSize,
+                &m_avcMvBufferIndex,
+                m_resAvcDmvBuffers));
+
+            dmvidx = m_avcMvBufferIndex;
+
+            //first and second field will use the same DMV buffer in field mode
+            m_avcRefList[currPic.FrameIdx]->ucDMVIdx[0] = dmvidx;
+            m_avcRefList[currPic.FrameIdx]->ucDMVIdx[1] = dmvidx;
+        }
     }
     else
     {
@@ -685,7 +759,7 @@ MOS_STATUS CodechalDecodeAvc::SetPicture
             picIdx[i].bValid = true;
             picIdx[i].ucPicIdx = index;
 
-            if (!CodecHal_PictureIsInvalid(prevPic))
+            if (!CodecHal_PictureIsInvalid(prevPic) && !m_osInterface->pfnIsMismatchOrderProgrammingSupported())
             {
                 for (ii = 0; ii < m_avcRefList[prevPic.FrameIdx]->ucNumRef; ii++)
                 {
@@ -735,6 +809,14 @@ MOS_STATUS CodechalDecodeAvc::SetPicture
     m_avcRefList[currPic.FrameIdx]->usNonExistingFrameFlags = nonExistingFrameFlags;
     m_avcRefList[currPic.FrameIdx]->uiUsedForReferenceFlags = usedForReferenceFlags;
 
+    if (m_osInterface->pfnIsMismatchOrderProgrammingSupported())
+    {
+        for (uint32_t ii = 0; ii < CODEC_AVC_NUM_UNCOMPRESSED_SURFACE; ii++)
+        {
+            m_avcRefList[ii]->ucFrameId = 0x7f;
+        }
+    }
+
     SetFrameStoreIds(currPic.FrameIdx);
 
     // Store CurrFieldOrderCnt
@@ -924,7 +1006,10 @@ MOS_STATUS CodechalDecodeAvc::AllocateRe
         (picHeightInMB > m_picHeightInMbLastMaxAlloced) ||
         (m_avcDmvBufferSize == 0))
     {
-        for (ctr = 0; ctr < CODEC_AVC_NUM_DMV_BUFFERS; ctr++)
+        uint32_t maxMvBuf = m_osInterface->pfnIsMismatchOrderProgrammingSupported() ?
+            CODEC_AVC_NUM_UNCOMPRESSED_SURFACE :
+            CODEC_AVC_NUM_DMV_BUFFERS;
+        for (ctr = 0; ctr < maxMvBuf; ctr++)
         {
             if (!Mos_ResourceIsNull(&m_resAvcDmvBuffers[ctr]))
             {
@@ -1144,7 +1229,10 @@ CodechalDecodeAvc::~CodechalDecodeAvc()
             &m_resMonoPictureChromaBuffer);
     }
 
-    for (uint32_t ctr = 0; ctr < CODEC_AVC_NUM_DMV_BUFFERS; ctr++)
+    uint32_t maxMvBuf = m_osInterface->pfnIsMismatchOrderProgrammingSupported() ?
+        CODEC_AVC_NUM_UNCOMPRESSED_SURFACE :
+        CODEC_AVC_NUM_DMV_BUFFERS;
+    for (uint32_t ctr = 0; ctr < maxMvBuf; ctr++)
     {
         m_osInterface->pfnFreeResource(
             m_osInterface,
@@ -1307,10 +1395,13 @@ MOS_STATUS CodechalDecodeAvc::SetFrameSt
         m_secondField = true;
     }
 
-    m_pCodechalOcaDumper->SetAvcDecodeParam(
-        m_avcPicParams,
-        m_avcSliceParams,
-        m_numSlices);
+    if (m_pCodechalOcaDumper)
+    {
+        m_pCodechalOcaDumper->SetAvcDecodeParam(
+            m_avcPicParams,
+            m_avcSliceParams,
+            m_numSlices);
+    }
 
     CODECHAL_DEBUG_TOOL(
         m_debugInterface->m_currPic     = m_crrPic;
@@ -2046,7 +2137,7 @@ CodechalDecodeAvc::CodechalDecodeAvc(
     MOS_ZeroMemory(&m_resMfdDeblockingFilterRowStoreScratchBuffer, sizeof(MOS_RESOURCE));
     MOS_ZeroMemory(&m_resBsdMpcRowStoreScratchBuffer, sizeof(MOS_RESOURCE));
     MOS_ZeroMemory(&m_resMprRowStoreScratchBuffer, sizeof(MOS_RESOURCE));
-    MOS_ZeroMemory(&m_resAvcDmvBuffers, (sizeof(MOS_RESOURCE) * CODEC_AVC_NUM_DMV_BUFFERS));
+    MOS_ZeroMemory(&m_resAvcDmvBuffers, (sizeof(MOS_RESOURCE) * CODEC_AVC_NUM_UNCOMPRESSED_SURFACE));
     MOS_ZeroMemory(&m_resInvalidRefBuffer, sizeof(MOS_RESOURCE));
     MOS_ZeroMemory(&m_resMvcDummyDmvBuffer, (sizeof(MOS_RESOURCE) * 2));
     MOS_ZeroMemory(&m_destSurface, sizeof(MOS_SURFACE));
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_avc.h 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_avc.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_avc.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_avc.h	2022-07-19 15:03:31.000000000 +0000
@@ -222,6 +222,28 @@ public:
         MOS_RESOURCE                *avcDmvBuffers);
 
     //!
+    //! \brief    Set and Alloc Dmv Buffer
+    //! \details  Set and Alloc Dmv Buffer in AVC decode driver
+    //!
+    //! \param    [in] frameIdx
+    //!           frame idx
+    //! \param    [in] avcDmvBufferSize
+    //!           Dmv Bufer Size
+    //! \param    [out] dmvIdx
+    //!           Dmv Index
+    //! \param    [out] avcDmvBuffers
+    //!           Dmv Buffers
+    //!
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    MOS_STATUS SetAndAllocateDmvBufferIndexMismatched(
+        uint8_t             frameIdx,
+        uint32_t            avcDmvBufferSize,
+        uint8_t            *dmvIdx,
+        MOS_RESOURCE       *avcDmvBuffers);
+
+    //!
     //! \brief    Init Mvc Dummy Dmv Buffer
     //! \details  Init Mvc Dummy Dmv Buffer in AVC decode driver
     //!
@@ -399,7 +421,7 @@ public:
     MOS_RESOURCE  m_resMfdDeblockingFilterRowStoreScratchBuffer;  //!< Handle of MFD Deblocking Filter Row Store Scratch data surface
     MOS_RESOURCE  m_resBsdMpcRowStoreScratchBuffer;               //!< Handle of BSD/MPC Row Store Scratch data surface
     MOS_RESOURCE  m_resMprRowStoreScratchBuffer;                  //!< Handle of MPR Row Store Scratch data surface
-    MOS_RESOURCE  m_resAvcDmvBuffers[CODEC_AVC_NUM_DMV_BUFFERS];  //!< Handle of Dmv Buffers
+    MOS_RESOURCE  m_resAvcDmvBuffers[CODEC_AVC_NUM_UNCOMPRESSED_SURFACE];  //!< Handle of Dmv Buffers, only used CODEC_AVC_NUM_DMV_BUFFERS normally
     MOS_RESOURCE  m_resInvalidRefBuffer;                          //!< Handle of Invalid Ref Buffer
     MOS_RESOURCE  m_resMvcDummyDmvBuffer[2];                      //!< Handle of Mvc Dummy Dmv Buffer
     MOS_SURFACE   m_destSurface;                                  //!< Handle of Dest data surface
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -513,7 +513,8 @@ MOS_STATUS CodechalDecodeHevc::AllocateM
     MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
     CODECHAL_DECODE_FUNCTION_ENTER;
 
-    if (hevcMvBuffIndex == CODEC_NUM_HEVC_MV_BUFFERS)
+    // Non-mismatch order programming mode has the limiation of mv buffer num CODEC_NUM_HEVC_MV_BUFFERS
+    if (hevcMvBuffIndex == CODEC_NUM_HEVC_MV_BUFFERS && !m_osInterface->pfnIsMismatchOrderProgrammingSupported())
     {
         // Should never happen, something must be wrong
         CODECHAL_DECODE_ASSERTMESSAGE("Failed to get avaiable MV buffer.");
@@ -622,7 +623,10 @@ CodechalDecodeHevc::~CodechalDecodeHevc
         m_osInterface,
         &m_resSaoTileColumnBuffer);
 
-    for (uint32_t i = 0; i < CODEC_NUM_HEVC_MV_BUFFERS; i++)
+    uint32_t mvBufNum = m_osInterface->pfnIsMismatchOrderProgrammingSupported() ?
+        CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC :
+        CODEC_NUM_HEVC_MV_BUFFERS;
+    for (uint32_t i = 0; i < mvBufNum; i++)
     {
         m_osInterface->pfnFreeResource(
             m_osInterface,
@@ -1299,14 +1303,17 @@ MOS_STATUS CodechalDecodeHevc::SetFrameS
     m_secondField =
         CodecHal_PictureIsBottomField(m_hevcPicParams->CurrPic);
 
-    m_pCodechalOcaDumper->SetHevcDecodeParam(
-        m_hevcPicParams,
-        nullptr,
-        nullptr,
-        m_hevcSliceParams,
-        nullptr,
-        m_numSlices,
-        m_shortFormatInUse);
+    if (m_pCodechalOcaDumper)
+    {
+        m_pCodechalOcaDumper->SetHevcDecodeParam(
+            m_hevcPicParams,
+            nullptr,
+            nullptr,
+            m_hevcSliceParams,
+            nullptr,
+            m_numSlices,
+            m_shortFormatInUse);
+    }
 
     CODECHAL_DEBUG_TOOL(
         m_debugInterface->m_currPic     = m_crrPic;
@@ -1388,41 +1395,70 @@ MOS_STATUS CodechalDecodeHevc::SetPictur
         hevcRefList[m_currPic.FrameIdx]->RefList[i] = picParams->RefFrameList[i];
     }
 
-    if(!CodecHal_PictureIsInvalid(prevPic))
+    if(m_osInterface->pfnIsMismatchOrderProgrammingSupported())
     {
-        for(i = 0; i < CODEC_NUM_HEVC_MV_BUFFERS; i++)
+        for (i = 0; i < CODEC_MAX_NUM_REF_FRAME_HEVC; i++)
         {
-            hevcMVBufferList[i].bInUse    = false;
-            hevcMVBufferList[i].u8FrameId = 0;
+            auto frameIdx = picParams->RefFrameList[i].FrameIdx;
+            if (frameIdx != CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC)
+            {
+                hevcRefList[frameIdx]->resRefPic         = m_decodeParams.m_refFrameSurface[frameIdx].OsResource;
+                hevcRefList[frameIdx]->sFrameNumber      = (int16_t)picParams->PicOrderCntValList[i];
+                hevcRefList[frameIdx]->iFieldOrderCnt[0] = picParams->PicOrderCntValList[i];
+                hevcRefList[frameIdx]->RefPic            = picParams->RefFrameList[i];
+            }
         }
+    }
 
-        //Mark Referenced frame's MV buffer as used
-        for(i = 0; i < CODEC_MAX_NUM_REF_FRAME_HEVC; i++)
+    if (m_osInterface->pfnIsMismatchOrderProgrammingSupported())
+    {
+        for (i = 0; i < CODEC_MAX_NUM_REF_FRAME_HEVC; i++)
         {
-            uint8_t index = picParams->RefFrameList[i].FrameIdx;
-            if(!CodecHal_PictureIsInvalid(picParams->RefFrameList[i])
-                && index != picParams->CurrPic.FrameIdx)
+            auto frameIdx = picParams->RefFrameList[i].FrameIdx;
+            if (frameIdx != CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC)
             {
-                if (index < CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC)
-                {
-                    hevcMVBufferList[hevcRefList[index]->ucDMVIdx[0]].bInUse = true;
-                    hevcMVBufferList[hevcRefList[index]->ucDMVIdx[0]].u8FrameId = index;
-                }
+                AllocateMvTemporalBuffer(frameIdx);
             }
         }
+        AllocateMvTemporalBuffer(m_currPic.FrameIdx);
+        m_hevcMvBufferIndex = m_currPic.FrameIdx;
     }
+    else
+    {
+        if (!CodecHal_PictureIsInvalid(prevPic))
+        {
+            for (i = 0; i < CODEC_NUM_HEVC_MV_BUFFERS; i++)
+            {
+                hevcMVBufferList[i].bInUse    = false;
+                hevcMVBufferList[i].u8FrameId = 0;
+            }
 
-    //Find out an unused MvBuffer for current frame
-    m_hevcMvBufferIndex = GetMvBufferIndex(
-        m_currPic.FrameIdx);
+            //Mark Referenced frame's MV buffer as used
+            for (i = 0; i < CODEC_MAX_NUM_REF_FRAME_HEVC; i++)
+            {
+                uint8_t index = picParams->RefFrameList[i].FrameIdx;
+                if (!CodecHal_PictureIsInvalid(picParams->RefFrameList[i]) && index != picParams->CurrPic.FrameIdx)
+                {
+                    if (index < CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC)
+                    {
+                        hevcMVBufferList[hevcRefList[index]->ucDMVIdx[0]].bInUse    = true;
+                        hevcMVBufferList[hevcRefList[index]->ucDMVIdx[0]].u8FrameId = index;
+                    }
+                }
+            }
+        }
 
-    if (m_mvBufferProgrammed)
-    {
-        AllocateMvTemporalBuffer(m_hevcMvBufferIndex);
-    }
+        //Find out an unused MvBuffer for current frame
+        m_hevcMvBufferIndex = GetMvBufferIndex(
+            m_currPic.FrameIdx);
 
-    hevcRefList[m_currPic.FrameIdx]->ucDMVIdx[0] = m_hevcMvBufferIndex;
+        if (m_mvBufferProgrammed)
+        {
+            AllocateMvTemporalBuffer(m_hevcMvBufferIndex);
+        }
 
+        hevcRefList[m_currPic.FrameIdx]->ucDMVIdx[0] = m_hevcMvBufferIndex;
+    }
     return eStatus;
 }
 
@@ -1677,18 +1713,29 @@ MOS_STATUS CodechalDecodeHevc::InitPicLo
                 {
                     m_presReferences[k] = &(m_hevcRefList[refFrameValue]->resRefPic);
 
-                    for (uint8_t j = 0; j < CODEC_NUM_HEVC_MV_BUFFERS; j++)
+                    if (m_osInterface->pfnIsMismatchOrderProgrammingSupported())
+                    {
+                        m_picMhwParams.PipeBufAddrParams->presColMvTempBuffer[m++] = &m_resMvTemporalBuffer[refFrameValue];
+                        if (firstValidMvBuf == nullptr)
+                        {
+                            firstValidMvBuf = &m_resMvTemporalBuffer[refFrameValue];
+                        }
+                    }
+                    else
                     {
-                        if ((m_hevcMvList[j].bInUse) &&
-                            (m_hevcMvList[j].u8FrameId == refFrameValue) &&
-                            !Mos_ResourceIsNull(&m_resMvTemporalBuffer[j]))
+                        for (uint8_t j = 0; j < CODEC_NUM_HEVC_MV_BUFFERS; j++)
                         {
-                            m_picMhwParams.PipeBufAddrParams->presColMvTempBuffer[m++] = &m_resMvTemporalBuffer[j];
-                            if (firstValidMvBuf == nullptr)
+                            if ((m_hevcMvList[j].bInUse) &&
+                                (m_hevcMvList[j].u8FrameId == refFrameValue) &&
+                                !Mos_ResourceIsNull(&m_resMvTemporalBuffer[j]))
                             {
-                                firstValidMvBuf = &m_resMvTemporalBuffer[j];
+                                m_picMhwParams.PipeBufAddrParams->presColMvTempBuffer[m++] = &m_resMvTemporalBuffer[j];
+                                if (firstValidMvBuf == nullptr)
+                                {
+                                    firstValidMvBuf = &m_resMvTemporalBuffer[j];
+                                }
+                                break;
                             }
-                            break;
                         }
                     }
 
@@ -1768,12 +1815,25 @@ MOS_STATUS CodechalDecodeHevc::InitPicLo
             }
         }
 
-        for (uint32_t n = 0; n < CODEC_NUM_HEVC_MV_BUFFERS; n++)
+        if (m_osInterface->pfnIsMismatchOrderProgrammingSupported())
+        {
+            for (uint32_t n = 0; n < CODEC_NUM_HEVC_MV_BUFFERS; n++)
+            {
+                if (m_picMhwParams.PipeBufAddrParams->presColMvTempBuffer[n] == nullptr)
+                {
+                    m_picMhwParams.PipeBufAddrParams->presColMvTempBuffer[n] = firstValidMvBuf;
+                }
+            }
+        }
+        else
         {
-            if (m_picMhwParams.PipeBufAddrParams->presColMvTempBuffer[n] == nullptr &&
-                !Mos_ResourceIsNull(&m_resMvTemporalBuffer[n]))
+            for (uint32_t n = 0; n < CODEC_NUM_HEVC_MV_BUFFERS; n++)
             {
-                m_picMhwParams.PipeBufAddrParams->presColMvTempBuffer[n] = &m_resMvTemporalBuffer[n];
+                if (m_picMhwParams.PipeBufAddrParams->presColMvTempBuffer[n] == nullptr &&
+                    !Mos_ResourceIsNull(&m_resMvTemporalBuffer[n]))
+                {
+                    m_picMhwParams.PipeBufAddrParams->presColMvTempBuffer[n] = &m_resMvTemporalBuffer[n];
+                }
             }
         }
     }
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.h 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.h	2022-07-19 15:03:31.000000000 +0000
@@ -537,7 +537,7 @@ public:
     MOS_RESOURCE     m_resSaoTileLineBuffer;                            //!< Handle of SAO Tile Line data buffer
     MOS_RESOURCE     m_resSaoTileColumnBuffer;                          //!< Handle of SAO Tile Column data buffer
     bool             m_mvBufferProgrammed;                              //!< Indicate mv buffer is programmed
-    MOS_RESOURCE     m_resMvTemporalBuffer[CODEC_NUM_HEVC_MV_BUFFERS];  //!< Handles of MV Temporal data buffer
+    MOS_RESOURCE     m_resMvTemporalBuffer[CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC];  //!< Handles of MV Temporal data buffer, only use CODEC_NUM_HEVC_MV_BUFFERS normally
     uint32_t         m_secondLevelBatchBufferIndex;
     MHW_BATCH_BUFFER m_secondLevelBatchBuffer[CODEC_HEVC_NUM_SECOND_BB];//!< Handle of second level batch buffer
     uint32_t         m_dmemBufferIdx;                                   //!< Indicate current idx of DMEM buffer to program
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_jpeg.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_jpeg.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_jpeg.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decode_jpeg.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -28,6 +28,7 @@
 #include "codechal_decode_jpeg.h"
 #include "codechal_mmc_decode_jpeg.h"
 #include "hal_oca_interface.h"
+#include "mos_interface.h"
 #if USE_CODECHAL_DEBUG_TOOL
 #include <sstream>
 #include "codechal_debug.h"
@@ -379,7 +380,7 @@ MOS_STATUS CodechalDecodeJpeg::CheckSupp
     // real output format (ARGB8888) should also be from JPEG PPS; MSDK would handle the details of treating AYUV as ARGB.
     if (*format == Format_420O || *format == Format_AYUV)
     {
-        *format = m_osInterface->pfnFmt_OsToMos((MOS_OS_FORMAT)m_jpegPicParams->m_renderTargetFormat);
+        *format = MosInterface::OsFmtToMosFmt(m_jpegPicParams->m_renderTargetFormat);
     }
 
     //No support for RGBP/BGRP channel swap or YUV/RGB conversion!
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decoder.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decoder.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decoder.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_decoder.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -444,6 +444,7 @@ MOS_STATUS CodechalDecode::Allocate (Cod
             &m_decodeStatusBuf.m_statusBuffer,
             &lockFlagsNoOverWrite);
 
+        CODECHAL_DECODE_CHK_NULL_RETURN(data);
         MOS_ZeroMemory(data, statusBufferSize);
         m_decodeStatusBuf.m_data            = (uint32_t *)data;
         m_decodeStatusBuf.m_decodeStatus    = (CodechalDecodeStatus *)(data + sizeof(uint32_t) * 2);
@@ -1541,7 +1542,7 @@ MOS_STATUS CodechalDecode::EndStatusRepo
     MHW_MI_STORE_REGISTER_MEM_PARAMS regParams;
     regParams.presStoreBuffer   = &m_decodeStatusBuf.m_statusBuffer;
     regParams.dwOffset          = errStatusOffset;
-    regParams.dwRegister        = (m_standard == CODECHAL_HEVC && mmioRegistersHcp) ?
+    regParams.dwRegister        = ((m_standard == CODECHAL_HEVC || m_standard == CODECHAL_VP9) && mmioRegistersHcp) ?
         mmioRegistersHcp->hcpCabacStatusRegOffset : mmioRegistersMfx->mfxErrorFlagsRegOffset;
     CODECHAL_DECODE_CHK_STATUS_RETURN(m_miInterface->AddMiStoreRegisterMemCmd(
         cmdBuffer,
@@ -1580,7 +1581,7 @@ MOS_STATUS CodechalDecode::EndStatusRepo
 
     regParams.presStoreBuffer   = &m_decodeStatusBuf.m_statusBuffer;
     regParams.dwOffset          = mbCountOffset;
-    regParams.dwRegister        = (m_standard == CODECHAL_HEVC && mmioRegistersHcp) ?
+    regParams.dwRegister        = ((m_standard == CODECHAL_HEVC || m_standard == CODECHAL_VP9) && mmioRegistersHcp) ?
         mmioRegistersHcp->hcpDecStatusRegOffset : mmioRegistersMfx->mfxMBCountRegOffset;
     CODECHAL_DECODE_CHK_STATUS_RETURN(m_miInterface->AddMiStoreRegisterMemCmd(
         cmdBuffer,
@@ -1773,10 +1774,11 @@ MOS_STATUS CodechalDecode::GetStatusRepo
                     // No problem in execution
                     codecStatus[j].m_codecStatus = CODECHAL_STATUS_SUCCESSFUL;
 
-                    if (m_standard == CODECHAL_HEVC)
+                    if (m_standard == CODECHAL_HEVC || m_standard == CODECHAL_VP9)
                     {
                         if ((m_decodeStatusBuf.m_decodeStatus[i].m_mmioErrorStatusReg &
-                             m_hcpInterface->GetHcpCabacErrorFlagsMask()) != 0)
+                             m_hcpInterface->GetHcpCabacErrorFlagsMask()) != 0
+                            && ((m_decodeStatusBuf.m_decodeStatus[i].m_mmioMBCountReg & 0xFFFC0000) >> 18) != 0)
                         {
                             codecStatus[j].m_codecStatus = CODECHAL_STATUS_ERROR;
                             codecStatus[j].m_numMbsAffected =
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_avc_base.h 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_avc_base.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_avc_base.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_avc_base.h	2022-07-19 15:03:31.000000000 +0000
@@ -36,11 +36,7 @@
 #define CODECHAL_ENCODE_AVC_INVALID_ROUNDING                0xFF
 #define CODECHAL_ENCODE_AVC_NUM_SYNC_TAGS                   64
 #define CODECHAL_ENCODE_AVC_INIT_DSH_SIZE                   MHW_PAGE_SIZE * 3
-#define CODECHAL_ENCODE_AVC_MAX_SLICE_QP                    (CODEC_AVC_NUM_QP - 1) // 0 - 51 inclusive
-#define CODECHAL_ENCODE_AVC_MIN_ICQ_QUALITYFACTOR           1
 #define CODECHAL_ENCODE_AVC_VDENC_MIN_ICQ_QUALITYFACTOR     11
-#define CODECHAL_ENCODE_AVC_MAX_ICQ_QUALITYFACTOR           51
-#define CODECHAL_ENCODE_AVC_MAX_SLICES_SUPPORTED            256
 #define CODECHAL_ENCODE_AVC_DEFAULT_AVBR_ACCURACY           30
 #define CODECHAL_ENCODE_AVC_MIN_AVBR_CONVERGENCE            100
 #define CODECHAL_ENCODE_AVC_DEFAULT_AVBR_CONVERGENCE        150
@@ -265,12 +261,6 @@ typedef struct _CODEC_AVC_REF_PIC_SELECT
     MOS_SURFACE             sBuffer;
 } CODEC_AVC_REF_PIC_SELECT_LIST, *PCODEC_AVC_REF_PIC_SELECT_LIST;
 
-typedef struct _CODECHAL_ENCODE_AVC_TQ_PARAMS
-{
-    uint32_t    dwTqEnabled;
-    uint32_t    dwTqRounding;
-} CODECHAL_ENCODE_AVC_TQ_PARAMS, *PCODECHAL_ENCODE_AVC_TQ_PARAMS;
-
 typedef struct _CODECHAL_ENCODE_AVC_GENERIC_PICTURE_LEVEL_PARAMS
 {
     PMOS_SURFACE                psPreDeblockSurface;
@@ -1179,60 +1169,6 @@ typedef struct _CODECHAL_ENCODE_AVC_SFD_
     bool                                    bVdencBrcEnabled;
 } CODECHAL_ENCODE_AVC_SFD_SURFACE_PARAMS, *PCODECHAL_ENCODE_AVC_SFD_SURFACE_PARAMS;
 
-typedef struct _CODECHAL_ENCODE_AVC_PACK_PIC_HEADER_PARAMS
-{
-    PBSBuffer                               pBsBuffer;
-    PCODEC_AVC_ENCODE_PIC_PARAMS            pPicParams;     // pAvcPicParams[ucPPSIdx]
-    PCODEC_AVC_ENCODE_SEQUENCE_PARAMS       pSeqParams;     // pAvcSeqParams[ucSPSIdx]
-    PCODECHAL_ENCODE_AVC_VUI_PARAMS         pAvcVuiParams;
-    PCODEC_AVC_IQ_MATRIX_PARAMS          pAvcIQMatrixParams;
-    PCODECHAL_NAL_UNIT_PARAMS               *ppNALUnitParams;
-    CodechalEncodeSeiData*                  pSeiData;
-    uint32_t                                dwFrameHeight;
-    uint32_t                                dwOriFrameHeight;
-    uint16_t                                wPictureCodingType;
-    bool                                    bNewSeq;
-    bool                                   *pbNewPPSHeader;
-    bool                                   *pbNewSeqHeader;
-} CODECHAL_ENCODE_AVC_PACK_PIC_HEADER_PARAMS, *PCODECHAL_ENCODE_AVC_PACK_PIC_HEADER_PARAMS;
-
-typedef struct _CODECHAL_ENCODE_AVC_PACK_SLC_HEADER_PARAMS
-{
-    PBSBuffer                               pBsBuffer;
-    PCODEC_AVC_ENCODE_PIC_PARAMS            pPicParams;     // pAvcPicParams[ucPPSIdx]
-    PCODEC_AVC_ENCODE_SEQUENCE_PARAMS       pSeqParams;     // pAvcSeqParams[ucSPSIdx]
-    PCODEC_AVC_ENCODE_SLICE_PARAMS          pAvcSliceParams;
-    PCODEC_REF_LIST                         *ppRefList;
-    CODEC_PICTURE                           CurrPic;
-    CODEC_PICTURE                           CurrReconPic;
-    CODEC_AVC_ENCODE_USER_FLAGS             UserFlags;
-    CODECHAL_ENCODE_AVC_NAL_UNIT_TYPE       NalUnitType;
-    uint16_t                                wPictureCodingType;
-    bool                                    bVdencEnabled;
-} CODECHAL_ENCODE_AVC_PACK_SLC_HEADER_PARAMS, *PCODECHAL_ENCODE_AVC_PACK_SLC_HEADER_PARAMS;
-
-typedef struct _CODECHAL_ENCODE_AVC_VALIDATE_NUM_REFS_PARAMS
-{
-    PCODEC_AVC_ENCODE_SEQUENCE_PARAMS       pSeqParams;     // pAvcSeqParams[ucSPSIdx]
-    PCODEC_AVC_ENCODE_PIC_PARAMS            pPicParams;
-    PCODEC_AVC_ENCODE_SLICE_PARAMS          pAvcSliceParams;
-    uint16_t                                wPictureCodingType;
-    uint16_t                                wPicHeightInMB;
-    uint16_t                                wFrameFieldHeightInMB;
-    bool                                    bFirstFieldIPic;
-    bool                                    bVDEncEnabled;
-    bool                                    bPAKonly;
-} CODECHAL_ENCODE_AVC_VALIDATE_NUM_REFS_PARAMS, *PCODECHAL_ENCODE_AVC_VALIDATE_NUM_REFS_PARAMS;
-
-typedef struct _CODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS
-{
-    uint16_t  wPictureCodingType;
-    uint8_t   ucTargetUsage;
-    uint8_t   ucQP;
-    bool      bBrcEnabled;
-    bool      bVdEncEnabled;
-} CODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS, *PCODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS;
-
 typedef struct _CODECHAL_ENCODE_AVC_SFD_CURBE_PARAMS
 {
     PMHW_KERNEL_STATE                       pKernelState;
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_avc.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_avc.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_avc.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_avc.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -7292,6 +7292,7 @@ MOS_STATUS CodechalEncodeAvcEnc::Allocat
                 m_osInterface,
                 &(resVMEScratchBuffer),
                 &lockFlagsWriteOnly);
+            CODECHAL_ENCODE_CHK_NULL_RETURN(data);
             MOS_ZeroMemory(data, size);
             m_osInterface->pfnUnlockResource(
                 m_osInterface,
@@ -7678,6 +7679,7 @@ MOS_STATUS CodechalEncodeAvcEnc::Allocat
             m_osInterface,
             &(BrcBuffers.resMbBrcConstDataBuffer[i]),
             &lockFlagsWriteOnly);
+        CODECHAL_ENCODE_CHK_NULL_RETURN(pData);
         MOS_ZeroMemory(pData, size);
         m_osInterface->pfnUnlockResource(
             m_osInterface,
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc_base.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc_base.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc_base.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc_base.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -2167,6 +2167,7 @@ MOS_STATUS CodechalEncodeHevcBase::ReadI
 MOS_STATUS CodechalEncodeHevcBase::UserFeatureKeyReport()
 {
     MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
+    MediaUserSettingSharedPtr       userSettingPtr = nullptr;
 
     CODECHAL_ENCODE_FUNCTION_ENTER;
 
@@ -2180,7 +2181,12 @@ MOS_STATUS CodechalEncodeHevcBase::UserF
     CodecHalEncode_WriteKey(__MEDIA_USER_FEATURE_VALUE_ENCODE_RATECONTROL_METHOD_ID, m_hevcSeqParams->RateControlMethod, m_osInterface->pOsContext);
 
 #if (_DEBUG || _RELEASE_INTERNAL)
-    CodecHalEncode_WriteKey(__MEDIA_USER_FEATURE_VALUE_SIM_IN_USE_ID, m_osInterface->bSimIsActive, m_osInterface->pOsContext);
+    userSettingPtr = m_osInterface->pfnGetUserSettingInstance(m_osInterface);
+    ReportUserSettingForDebug(
+        userSettingPtr,
+        __MEDIA_USER_FEATURE_VALUE_SIM_IN_USE,
+        m_osInterface->bSimIsActive,
+        MediaUserSetting::Group::Device);
     CodecHalEncode_WriteKey(__MEDIA_USER_FEATURE_VALUE_HEVC_ENCODE_RDOQ_ENABLE_ID, m_hevcRdoqEnabled, m_osInterface->pOsContext);
 #endif
 
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc_base.h 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc_base.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc_base.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc_base.h	2022-07-19 15:03:31.000000000 +0000
@@ -129,7 +129,6 @@
 #define CODECHAL_ENCODE_HEVC_NUM_MAX_VDENC_L0_REF_G10  3 // multiref, hevc vdenc
 #define CODECHAL_ENCODE_HEVC_NUM_MAX_VDENC_L1_REF_G10  3 // multiref, hevc vdenc
 
-#define CODECHAL_VDENC_HEVC_BRC_HISTORY_BUF_SIZE             964
 #define CODECHAL_VDENC_HEVC_BRC_DEBUG_BUF_SIZE               0x1000 // 0x1000 = 4096
 #define CODECHAL_VDENC_HEVC_BRC_HUC_STATUS_ERROR_MASK        (1<<30)
 #define CODECHAL_VDENC_HEVC_BRC_HUC_STATUS_ARITHMETIC_OVERFLOW_ERROR_MASK   (1<<29)
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encode_hevc.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -1520,7 +1520,7 @@ MOS_STATUS CodechalEncHevcState::GetFram
         // LDB
         if (m_pictureCodingType == I_TYPE)
         {
-            if (m_hevcPicParams->HierarchLevelPlus1 == 0)
+            if (m_hevcSeqParams->HierarchicalFlag > 0 || m_hevcPicParams->HierarchLevelPlus1 == 0)
             {
                 m_currFrameBrcLevel = HEVC_BRC_FRAME_TYPE_I;
             }
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encoder_base.h 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encoder_base.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encoder_base.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_encoder_base.h	2022-07-19 15:03:31.000000000 +0000
@@ -128,12 +128,10 @@
 #define CODECHAL_ENCODE_RECYCLED_BUFFER_NUM             6
 
 // Encode Sizes
-#define CODECHAL_ENCODE_STATUS_NUM                      512
 #define CODECHAL_ENCODE_VME_BBUF_NUM                    2
 #define CODECHAL_ENCODE_MIN_SCALED_SURFACE_SIZE         48
 #define CODECHAL_ENCODE_BRC_PAK_STATISTICS_SIZE         64
 #define CODECHAL_ENCODE_MAX_NUM_MAD_BUFFERS             CODEC_MAX_NUM_REF_FIELD
-#define CODECHAL_ENCODE_SLICESIZE_BUF_SIZE              (4960 * sizeof(uint16_t))
 #define CODECHAL_VDENC_BRC_NUM_OF_PASSES                2
 #define CODECHAL_VDENC_BRC_NUM_OF_PASSES_FOR_TILE_REPLAY 22
 #define CODECHAL_DP_MAX_NUM_BRC_PASSES                  4
@@ -147,32 +145,13 @@
 #define CODECHAL_ENCODE_FIELD_NUM_MAX_VME_L0_REF        4 // multiref - G7.5+
 #define CODECHAL_ENCODE_FIELD_NUM_MAX_VME_L1_REF        1 // multiref - G7.5+
 #define CODECHAL_LPLA_NUM_OF_PASSES                     2
+#define CODECHAL_VP9_MB_CODE_SIZE                       204
 
 // BRC
 #define CODECHAL_ENCODE_BRC_KBPS                        1000  // 1000bps for disk storage, aligned with industry usage
-#define CODECHAL_ENCODE_SCENE_CHANGE_DETECTED_MASK      0xffff
 #define CODECHAL_ENCODE_MIN_BITS_PER_PIXEL              12  // 8b 420
 #define CODECHAL_ENCODE_MAX_BITSTREAM_COMPRESSION       700
 
-typedef enum _CODECHAL_ENCODE_FUNCTION_ID
-{
-    CODECHAL_ENCODE_ENC_ID           = 0x100,
-    CODECHAL_ENCODE_PAK_ID           = 0x101,
-    CODECHAL_ENCODE_ENC_PAK_ID       = 0x102,
-    CODECHAL_ENCODE_VPP_ID           = 0x103,
-    CODECHAL_ENCODE_FORMAT_COUNT_ID  = 0x104,
-    CODECHAL_ENCODE_FORMATS_ID       = 0x105,
-    CODECHAL_ENCODE_ENC_CTRL_CAPS_ID = 0x106,
-    CODECHAL_ENCODE_ENC_CTRL_GET_ID  = 0x107,
-    CODECHAL_ENCODE_ENC_CTRL_SET_ID  = 0x108,
-    CODECHAL_ENCODE_MBDATA_LAYOUT_ID = 0x109,
-    CODECHAL_ENCODE_FEI_PRE_ENC_ID   = 0x10A,
-    CODECHAL_ENCODE_FEI_ENC_ID       = 0x10B,
-    CODECHAL_ENCODE_FEI_PAK_ID       = 0x10C,
-    CODECHAL_ENCODE_FEI_ENC_PAK_ID   = 0x10D,
-    CODECHAL_ENCODE_QUERY_STATUS_ID  = 0x121
-} CODECHAL_ENCODE_FUNCTION_ID;
-
 typedef enum _CODECHAL_ENCODE_BRC_KERNEL_STATE_IDX
 {
     CODECHAL_ENCODE_BRC_IDX_INIT = 0,
@@ -260,30 +239,6 @@ enum BrcUpdateFlag
     brcUpdateIsReference     = (0x01 << 7)
 };
 
-//!
-//! \enum   TrellisSetting
-//! \brief  Indicate the different Trellis Settings
-//!
-enum TrellisSetting
-{
-    trellisInternal = 0,
-    trellisDisabled = 1,
-    trellisEnabledI = 2,
-    trellisEnabledP = 4,
-    trellisEnabledB = 8
-};
-
-//!
-//! \enum   MbBrcSetting
-//! \brief  Indicate the MBBRC settings
-//!
-enum MbBrcSetting
-{
-    mbBrcInternal = 0,
-    mbBrcEnabled  = 1,
-    mbBrcDisabled = 2,
-};
-
 // User Feature Key Report Writeout
 #define CodecHalEncodeWriteKey64(key, value, mosCtx)\
 {\
@@ -695,35 +650,6 @@ struct SearchPathDelta
 };
 
 //!
-//! \struct    HwCounter
-//! \brief     Hardware counter
-//!
-struct HwCounter
-{
-    uint64_t IV;         // Big-Endian IV
-    uint64_t Count;      // Big-Endian Block Count
-};
-
-//!
-//! \struct PerfTagSetting
-//! \brief  Setting of performance tags
-//!
-struct PerfTagSetting
-{
-    union
-    {
-        struct
-        {
-            uint16_t    PictureCodingType   : 2;
-            uint16_t    CallType            : 6;
-            uint16_t    Mode                : 4;
-            uint16_t                        : 4;
-        };
-        uint16_t        Value;
-    };
-};
-
-//!
 //! \struct SendKernelCmdsParams
 //! \brief  Struct of send kernel commands parameters
 //!
@@ -840,21 +766,6 @@ struct CODECHAL_ENCODE_BUFFER
 using PCODECHAL_ENCODE_BUFFER = CODECHAL_ENCODE_BUFFER*;
 
 //!
-//! \struct CodechalTileInfo
-//! \brief Tile info report to application
-//!
-struct CodechalTileInfo
-{
-    uint16_t    TileRowNum;
-    uint16_t    TileColNum;
-    uint32_t    TileBitStreamOffset;
-    uint32_t    TileSizeInBytes;
-
-    uint32_t    reserved;
-    HwCounter   HWCounterValue;
-};
-
-//!
 //! \struct EncodeStatusReport
 //! \brief  Encode status report structure
 //!
@@ -1222,15 +1133,6 @@ struct CodechalEncodeIdOffsetParams
 };
 
 //!
-//! \struct VdencBrcPakMmio
-//! \brief  MMIO of BRC and PAK
-//!
-struct VdencBrcPakMmio
-{
-    uint32_t                dwReEncode[4];
-};
-
-//!
 //! \struct VdencHucErrorStatus
 //! \brief  Huc Error Flags
 //!
@@ -1250,53 +1152,6 @@ enum EncodeMode
     encodeQualityMode = 2
 };
 
-enum
-{
-    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_PHASE1_KERNEL = CODECHAL_ENCODE_PERFTAG_CALL_MBENC_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_PHASE2_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_SCALING_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_INTRA_DIST,
-    CODECHAL_ENCODE_PERFTAG_CALL_ME_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_BRC_INIT_RESET,
-    CODECHAL_ENCODE_PERFTAG_CALL_BRC_UPDATE,
-    CODECHAL_ENCODE_PERFTAG_CALL_BRC_COPY,
-    CODECHAL_ENCODE_PERFTAG_CALL_PAK_ENGINE,
-    CODECHAL_ENCODE_PERFTAG_CALL_PAK_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_PAK_PHASE1_KERNEL = CODECHAL_ENCODE_PERFTAG_CALL_PAK_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_PAK_PHASE2_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_UPSCALING,
-    CODECHAL_ENCODE_PERFTAG_CALL_DEBLOCKING,
-    CODECHAL_ENCODE_PERFTAG_CALL_WP_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_32X32_PU_MD,
-    CODECHAL_ENCODE_PERFTAG_CALL_32X32_B_IC,
-    CODECHAL_ENCODE_PERFTAG_CALL_16X16_PU_MD,
-    CODECHAL_ENCODE_PERFTAG_CALL_16X16_SAD,
-    CODECHAL_ENCODE_PERFTAG_CALL_8X8_PU,
-    CODECHAL_ENCODE_PERFTAG_CALL_8X8_FMODE,
-    CODECHAL_ENCODE_PERFTAG_CALL_BRC_UPDATE_LCU,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_I_32x32,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_I_16x16,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_P,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBENC_TX,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_RECON_LUMA,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_RECON_CHROMA,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_RECON_LUMA_32x32,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_RECON_INTRA_LUMA,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_RECON_INTRA_CHROMA,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_DEBLOCK_MASK,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_DEBLOCK_LUMA,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_DEBLOCK_CHROMA,
-    CODECHAL_ENCODE_PERFTAG_CALL_MBPAK_MC,
-    CODECHAL_ENCODE_PERFTAG_CALL_PREPROC_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_DS_CONVERSION_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_SCOREBOARD,
-    CODECHAL_ENCODE_PERFTAG_CALL_SFD_KERNEL,
-    CODECHAL_ENCODE_PERFTAG_CALL_PAK_ENGINE_SECOND_PASS,
-    CODECHAL_ENCODE_PERFTAG_CALL_BRC_UPDATE_SECOND_PASS,
-    CODECHAL_ENCODE_PERFTAG_CALL_HEVC_LA_UPDATE
-};
-
 class CodechalEncodeWP;
 #if USE_CODECHAL_DEBUG_TOOL
 class CodechalDebugEncodePar;
@@ -2775,12 +2630,4 @@ static void PutBits(BSBuffer *bsbuffer,
     }
 }
 
-template<typename ValueType>
-static ValueType SwapEndianness(ValueType value)
-{
-    uint8_t*    startLocation = reinterpret_cast<uint8_t*>(&value);
-    uint8_t*    endLocation = startLocation + sizeof(ValueType);
-    std::reverse(startLocation, endLocation);
-    return value;
-}
 #endif  // __CODECHAL_ENCODER_BASE_H__
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_hw.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_hw.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_hw.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_hw.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -26,8 +26,6 @@
 #include "codechal_hw.h"
 #include "codechal_setting.h"
 
-#define VDBOX_HUC_VDENC_BRC_INIT_KERNEL_DESCRIPTOR 4
-
 //| HW parameter initializers
 const MOS_SYNC_PARAMS     g_cInitSyncParams =
 {
@@ -49,10 +47,6 @@ CodechalHwInterface::CodechalHwInterface
 {
     CODECHAL_HW_FUNCTION_ENTER;
 
-#if MHW_HWCMDPARSER_ENABLED
-    mhw::HwcmdParser::InitInstance(osInterface);
-#endif
-
     // Basic intialization
     m_osInterface = osInterface;
 
@@ -93,10 +87,6 @@ CodechalHwInterface::CodechalHwInterface
 {
     CODECHAL_HW_FUNCTION_ENTER;
 
-#if MHW_HWCMDPARSER_ENABLED
-    mhw::HwcmdParser::InitInstance(osInterface);
-#endif
-
     // Basic intialization
     m_osInterface = osInterface;
 
@@ -658,7 +648,9 @@ MOS_STATUS CodechalHwInterface::GetStrea
 MOS_STATUS CodechalHwInterface::Initialize(
     CodechalSetting *settings)
 {
-    MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
+    MOS_STATUS                  eStatus         = MOS_STATUS_SUCCESS;
+    MediaUserSettingSharedPtr   userSettingPtr  = nullptr;
+    uint32_t                    value           = 0;
 
     CODECHAL_HW_FUNCTION_ENTER;
 
@@ -684,19 +676,19 @@ MOS_STATUS CodechalHwInterface::Initiali
     }
 
 #if (_DEBUG || _RELEASE_INTERNAL)
-    MOS_USER_FEATURE_VALUE_DATA userFeatureData;
-    MOS_ZeroMemory(&userFeatureData, sizeof(userFeatureData));
-    MOS_UserFeature_ReadValue_ID(
-        nullptr,
-        __MEDIA_USER_FEATURE_VALUE_SSEU_SETTING_OVERRIDE_ID,
-        &userFeatureData,
-        m_osInterface->pOsContext);
-    if (userFeatureData.i32Data != 0xDEADC0DE)
-    {
-        m_numRequestedEuSlicesOverride = userFeatureData.i32Data & 0xFF;              // Bits 0-7
-        m_numRequestedSubSlicesOverride = (userFeatureData.i32Data >> 8) & 0xFF;      // Bits 8-15
-        m_numRequestedEusOverride = (userFeatureData.i32Data >> 16) & 0xFFFF;         // Bits 16-31
-        m_numRequestedOverride = true;
+    userSettingPtr = m_osInterface->pfnGetUserSettingInstance(m_osInterface);
+    ReadUserSettingForDebug(
+        userSettingPtr,
+        value,
+        __MEDIA_USER_FEATURE_VALUE_SSEU_SETTING_OVERRIDE,
+        MediaUserSetting::Group::Device);
+
+    if (value != 0xDEADC0DE)
+    {
+        m_numRequestedEuSlicesOverride  = value & 0xFF;              // Bits 0-7
+        m_numRequestedSubSlicesOverride = (value >> 8) & 0xFF;      // Bits 8-15
+        m_numRequestedEusOverride       = (value >> 16) & 0xFFFF;         // Bits 16-31
+        m_numRequestedOverride          = true;
     }
 #endif
 
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_hw.h 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_hw.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_hw.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_hw.h	2022-07-19 15:03:31.000000000 +0000
@@ -28,14 +28,15 @@
 #define __CODECHAL_HW_H__
 
 #include "codechal.h"
-#include "renderhal.h"
+#include "renderhal_legacy.h"
 #include "mhw_mi.h"
-#include "mhw_render.h"
+#include "mhw_render_legacy.h"
 #include "mhw_state_heap.h"
 #include "mhw_vdbox.h"
 #include "mhw_vebox.h"
 #include "mhw_sfc.h"
 #include "mhw_cp_interface.h"
+#include "media_blt_copy.h"
 
 #include "mhw_vdbox_mfx_interface.h"
 #include "mhw_vdbox_hcp_interface.h"
@@ -45,6 +46,7 @@
 #include "mhw_vdbox_hcp_itf.h"
 
 #include "media_interfaces_mhw.h"
+#include "media_sfc_interface.h"
 
 #include "gfxmacro.h"
 
@@ -91,8 +93,6 @@
 #define CODECHAL_HW_CHK_COND_RETURN(_expr, _message, ...)                           \
     MOS_CHK_COND_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_HW,_expr,_message, ##__VA_ARGS__)
 
-#define CODECHAL_CACHELINE_SIZE                 64
-#define CODECHAL_PAGE_SIZE                      0x1000
 #define CODECHAL_PAK_OBJ_EACH_CU                66
 
 #define CODECHAL_SURFACE_PITCH_ALIGNMENT        128
@@ -107,9 +107,6 @@
 #define CODECHAL_VLINESTRIDEOFFSET_TOP_FIELD    0
 #define CODECHAL_VLINESTRIDEOFFSET_BOT_FIELD    1
 
-// Params for Huc
-#define HUC_DMEM_OFFSET_RTOS_GEMS                       0x2000
-
 #define CODECHAL_MAX_DEPENDENCY_COUNT  8
 
 #define CODECHAL_INVALID_BINDING_TABLE_IDX  0xFFFFFFFF
@@ -151,73 +148,6 @@ enum CodechalWalkingPattern
     codechalVerticalRasterScan               = 4
 };
 
-typedef enum _CODECHAL_MEDIA_STATE_TYPE
-{
-    CODECHAL_MEDIA_STATE_OLP                                = 0,
-    CODECHAL_MEDIA_STATE_ENC_NORMAL                         = 1,
-    CODECHAL_MEDIA_STATE_ENC_PERFORMANCE                    = 2,
-    CODECHAL_MEDIA_STATE_ENC_QUALITY                        = 3,
-    CODECHAL_MEDIA_STATE_ENC_I_FRAME_DIST                   = 4,
-    CODECHAL_MEDIA_STATE_32X_SCALING                        = 5,
-    CODECHAL_MEDIA_STATE_16X_SCALING                        = 6,
-    CODECHAL_MEDIA_STATE_4X_SCALING                         = 7,
-    CODECHAL_MEDIA_STATE_32X_ME                             = 8,
-    CODECHAL_MEDIA_STATE_16X_ME                             = 9,
-    CODECHAL_MEDIA_STATE_4X_ME                              = 10,
-    CODECHAL_MEDIA_STATE_BRC_INIT_RESET                     = 11,
-    CODECHAL_MEDIA_STATE_BRC_UPDATE                         = 12,
-    CODECHAL_MEDIA_STATE_BRC_BLOCK_COPY                     = 13,
-    CODECHAL_MEDIA_STATE_HYBRID_PAK_P1                      = 14,
-    CODECHAL_MEDIA_STATE_HYBRID_PAK_P2                      = 15,
-    CODECHAL_MEDIA_STATE_ENC_I_FRAME_CHROMA                 = 16,
-    CODECHAL_MEDIA_STATE_ENC_I_FRAME_LUMA                   = 17,
-    CODECHAL_MEDIA_STATE_MPU_FHB                            = 18,
-    CODECHAL_MEDIA_STATE_TPU_FHB                            = 19,
-    CODECHAL_MEDIA_STATE_PA_COPY                            = 20,
-    CODECHAL_MEDIA_STATE_PL2_COPY                           = 21,
-    CODECHAL_MEDIA_STATE_ENC_ADV                            = 22,
-    CODECHAL_MEDIA_STATE_2X_SCALING                         = 23,
-    CODECHAL_MEDIA_STATE_32x32_PU_MODE_DECISION             = 24,
-    CODECHAL_MEDIA_STATE_16x16_PU_SAD                       = 25,
-    CODECHAL_MEDIA_STATE_16x16_PU_MODE_DECISION             = 26,
-    CODECHAL_MEDIA_STATE_8x8_PU                             = 27,
-    CODECHAL_MEDIA_STATE_8x8_PU_FMODE                       = 28,
-    CODECHAL_MEDIA_STATE_32x32_B_INTRA_CHECK                = 29,
-    CODECHAL_MEDIA_STATE_HEVC_B_MBENC                       = 30,
-    CODECHAL_MEDIA_STATE_RESET_VLINE_STRIDE                 = 31,
-    CODECHAL_MEDIA_STATE_HEVC_B_PAK                         = 32,
-    CODECHAL_MEDIA_STATE_HEVC_BRC_LCU_UPDATE                = 33,
-    CODECHAL_MEDIA_STATE_ME_VDENC_STREAMIN                  = 34,
-    CODECHAL_MEDIA_STATE_VP9_ENC_I_32x32                    = 35,
-    CODECHAL_MEDIA_STATE_VP9_ENC_I_16x16                    = 36,
-    CODECHAL_MEDIA_STATE_VP9_ENC_P                          = 37,
-    CODECHAL_MEDIA_STATE_VP9_ENC_TX                         = 38,
-    CODECHAL_MEDIA_STATE_VP9_DYS                            = 39,
-    CODECHAL_MEDIA_STATE_VP9_PAK_LUMA_RECON                 = 40,
-    CODECHAL_MEDIA_STATE_VP9_PAK_CHROMA_RECON               = 41,
-    CODECHAL_MEDIA_STATE_VP9_PAK_DEBLOCK_MASK               = 42,
-    CODECHAL_MEDIA_STATE_VP9_PAK_LUMA_DEBLOCK               = 43,
-    CODECHAL_MEDIA_STATE_VP9_PAK_CHROMA_DEBLOCK             = 44,
-    CODECHAL_MEDIA_STATE_VP9_PAK_MC_PRED                    = 45,
-    CODECHAL_MEDIA_STATE_VP9_PAK_P_FRAME_LUMA_RECON         = 46,
-    CODECHAL_MEDIA_STATE_VP9_PAK_P_FRAME_LUMA_RECON_32x32   = 47,
-    CODECHAL_MEDIA_STATE_VP9_PAK_P_FRAME_CHROMA_RECON       = 48,
-    CODECHAL_MEDIA_STATE_VP9_PAK_P_FRAME_INTRA_LUMA_RECON   = 49,
-    CODECHAL_MEDIA_STATE_VP9_PAK_P_FRAME_INTRA_CHROMA_RECON = 50,
-    CODECHAL_MEDIA_STATE_PREPROC                            = 51,
-    CODECHAL_MEDIA_STATE_ENC_WP                             = 52,
-    CODECHAL_MEDIA_STATE_HEVC_I_MBENC                       = 53,
-    CODECHAL_MEDIA_STATE_CSC_DS_COPY                        = 54,
-    CODECHAL_MEDIA_STATE_2X_4X_SCALING                      = 55,
-    CODECHAL_MEDIA_STATE_HEVC_LCU64_B_MBENC                 = 56,
-    CODECHAL_MEDIA_STATE_MB_BRC_UPDATE                      = 57,
-    CODECHAL_MEDIA_STATE_STATIC_FRAME_DETECTION             = 58,
-    CODECHAL_MEDIA_STATE_HEVC_ROI                           = 59,
-    CODECHAL_MEDIA_STATE_SW_SCOREBOARD_INIT                 = 60,
-    CODECHAL_NUM_MEDIA_STATES                               = 61
-} CODECHAL_MEDIA_STATE_TYPE;
-C_ASSERT(CODECHAL_NUM_MEDIA_STATES == CODECHAL_MEDIA_STATE_SW_SCOREBOARD_INIT + 1);  //!< update this and add new entry in the default SSEU table for each platform()
-
 typedef enum _CODECHAL_SLICE_STATE
 {
     CODECHAL_SLICE_SHUTDOWN_DEFAULT     = 0,
@@ -257,36 +187,6 @@ struct CodechalQpStatusCount
 };
 
 //!
-//! \struct    CodechalHucStreamoutParams
-//! \brief     Codechal Huc streamout parameters
-//!
-struct CodechalHucStreamoutParams
-{
-    CODECHAL_MODE       mode;
-
-    // Indirect object addr command params
-    PMOS_RESOURCE       dataBuffer;
-    uint32_t            dataSize;              // 4k aligned
-    uint32_t            dataOffset;            // 4k aligned
-    PMOS_RESOURCE       streamOutObjectBuffer;
-    uint32_t            streamOutObjectSize;   // 4k aligned
-    uint32_t            streamOutObjectOffset; //4k aligned
-
-    // Stream object params
-    uint32_t            indStreamInLength;
-    uint32_t            inputRelativeOffset;
-    uint32_t            outputRelativeOffset;
-
-    // Segment Info
-    void               *segmentInfo;
-
-    // Indirect Security State
-    MOS_RESOURCE        hucIndState;
-    uint32_t            curIndEntriesNum;
-    uint32_t            curNumSegments;
-};
-
-//!
 //! \struct    CodechalDataCopyParams
 //! \brief     Codechal data copy parameters
 //!
@@ -304,38 +204,6 @@ struct CodechalDataCopyParams
 };
 
 //!
-//! \struct    EncodeStatusReadParams
-//! \brief     Read encode states parameters
-//!
-struct EncodeStatusReadParams
-{
-    bool          vdencBrcEnabled;
-    bool          waReadVDEncOverflowStatus;
-    uint32_t      mode ;
-
-    uint32_t      vdencBrcNumOfSliceOffset;
-    PMOS_RESOURCE *resVdencBrcUpdateDmemBufferPtr;
-
-    PMOS_RESOURCE resBitstreamByteCountPerFrame;
-    uint32_t      bitstreamByteCountPerFrameOffset;
-
-    PMOS_RESOURCE resBitstreamSyntaxElementOnlyBitCount;
-    uint32_t      bitstreamSyntaxElementOnlyBitCountOffset;
-
-    PMOS_RESOURCE resQpStatusCount;
-    uint32_t      qpStatusCountOffset;
-
-    PMOS_RESOURCE resNumSlices;
-    uint32_t      numSlicesOffset;
-
-    PMOS_RESOURCE resImageStatusMask;
-    uint32_t      imageStatusMaskOffset;
-
-    PMOS_RESOURCE resImageStatusCtrl;
-    uint32_t      imageStatusCtrlOffset;
-};
-
-//!
 //! \struct    BrcPakStatsReadParams
 //! \brief     Read brc pak states parameters
 //!
@@ -387,6 +255,7 @@ protected:
     MhwVdboxVdencInterface          *m_vdencInterface = nullptr;      //!< Pointer to Mhw vdenc interface
     std::shared_ptr<mhw::vdbox::hcp::Itf>   m_hcpItf   = nullptr;
     std::shared_ptr<mhw::vdbox::vdenc::Itf> m_vdencItf = nullptr;
+    std::shared_ptr<MediaSfcInterface> m_mediaSfcItf = nullptr;
 
     CODECHAL_SSEU_SETTING const         *m_ssEuTable = nullptr;       //!< Pointer to the default SSEU settings table
     uint16_t                            m_numMediaStates = CODECHAL_NUM_MEDIA_STATES;  //!< number of media states
@@ -685,6 +554,11 @@ public:
         return m_osInterface;
     }
 
+    inline std::shared_ptr<MediaSfcInterface> GetMediaSfcInterface()
+    {
+        return m_mediaSfcItf;
+    }
+
     //!
     //! \brief    Get State Heap Settings
     //! \details  Get State Heap Settings in codechal hw interface 
@@ -877,6 +751,17 @@ public:
         return m_cacheabilitySettings;
     }
 
+    //! \brief    Get blt state
+    //! \details  Get blt interface in codechal hw interface
+    //!
+    //! \return   [out] BltState*
+    //!           Interface got.
+    //!
+    virtual BltState *GetBltState()
+    {
+        return nullptr;
+    }
+
     //!
     //! \brief    Set Cacheability Settings
     //! \details  Set Cacheability Settings in sub interfaces in codechal hw interface 
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_memdecomp.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_memdecomp.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_memdecomp.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_memdecomp.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -891,6 +891,8 @@ MOS_STATUS MediaMemDecompState::Initiali
     MhwRenderInterface              *renderInterface)
 {
     MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
+    MediaUserSettingSharedPtr   userSettingPtr = nullptr;
+    MOS_USER_FEATURE_VALUE_DATA userFeatureData = {};
 
     MHW_FUNCTION_ENTER;
 
@@ -903,6 +905,7 @@ MOS_STATUS MediaMemDecompState::Initiali
     m_cpInterface = cpInterface;
     m_miInterface = miInterface;
     m_renderInterface = renderInterface;
+    userSettingPtr = osInterface->pfnGetUserSettingInstance(osInterface);
 
     for (uint8_t kernelIdx = decompKernelStatePa; kernelIdx < decompKernelStateMax; kernelIdx++)
     {
@@ -940,14 +943,11 @@ MOS_STATUS MediaMemDecompState::Initiali
     nullHWAccelerationEnable.Value = 0;
     m_disableDecodeSyncLock        = false;
 #if (_DEBUG || _RELEASE_INTERNAL)
-    MOS_USER_FEATURE_VALUE_DATA userFeatureData;
-    MOS_ZeroMemory(&userFeatureData, sizeof(userFeatureData));
-    MOS_UserFeature_ReadValue_ID(
-        nullptr,
-        __MEDIA_USER_FEATURE_VALUE_NULL_HW_ACCELERATION_ENABLE_ID,
-        &userFeatureData,
-        m_osInterface->pOsContext);
-    nullHWAccelerationEnable.Value = userFeatureData.u32Data;
+    ReadUserSettingForDebug(
+        userSettingPtr,
+        nullHWAccelerationEnable.Value,
+        __MEDIA_USER_FEATURE_VALUE_NULL_HW_ACCELERATION_ENABLE,
+        MediaUserSetting::Group::Device);
 
     MOS_ZeroMemory(&userFeatureData, sizeof(userFeatureData));
     MOS_UserFeature_ReadValue_ID(
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_memdecomp.h 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_memdecomp.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_memdecomp.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_memdecomp.h	2022-07-19 15:03:31.000000000 +0000
@@ -27,7 +27,7 @@
 #ifndef __CODECHAL_MEDIAMEMCOMP_H__
 #define __CODECHAL_MEDIAMEMCOMP_H__
 
-#include "mhw_render.h"
+#include "mhw_render_legacy.h"
 #include "mos_os.h"
 #include "mediamemdecomp.h"
 
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_vdenc_avc.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_vdenc_avc.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_vdenc_avc.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_vdenc_avc.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -5869,7 +5869,7 @@ MOS_STATUS CodechalVdencAvcState::Execut
     auto instance = mhw::HwcmdParser::GetInstance();
     if (instance)
     {
-        instance->UpdateFrameInfo(frameType);
+        instance->Update(frameType, nullptr);
     }
 #endif
 
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_vdenc_vp9_base.cpp 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_vdenc_vp9_base.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/codec/hal/codechal_vdenc_vp9_base.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/codec/hal/codechal_vdenc_vp9_base.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -38,6 +38,7 @@
 #include "codechal_vdenc_vp9_base.h"
 #include "codechal_mmc_encode_vp9.h"
 #include "codec_def_vp9_probs.h"
+#include "BRCIF.h"
 
 extern const uint8_t Keyframe_Default_Probs[2048] = {
     0x64, 0x42, 0x14, 0x98, 0x0f, 0x65, 0x03, 0x88, 0x25, 0x05, 0x34, 0x0d, 0x00, 0x00, 0x00, 0x00,
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/frame_tracker.cpp 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/frame_tracker.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/frame_tracker.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/frame_tracker.cpp	1970-01-01 00:00:00.000000000 +0000
@@ -1,199 +0,0 @@
-/*
-* Copyright (c) 2019-2021, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     frame_tracker.cpp
-//! \brief    Manages the multiple trackers in one place.
-//!
-
-#include "frame_tracker.h"
-#include "mhw_utilities.h"
-#include "mos_interface.h"
-
-bool FrameTrackerTokenFlat_IsExpired(const FrameTrackerTokenFlat *self)
-{
-    if (self->stick)
-    {
-        return false;
-    }
-    if (self->producer == nullptr)
-    {
-        return true;
-    }
-    for (int i = 0; i < MAX_TRACKER_NUMBER; i ++)
-    {
-        if (self->trackers[i] != 0)
-        {
-            volatile uint32_t latestTracker = *(self->producer->GetLatestTrackerAddress(i));
-            if ((int)(self->trackers[i] - latestTracker) > 0)
-            {
-                return false;
-            }
-        }
-    }
-    return true;
-}
-
-bool FrameTrackerToken::IsExpired()
-{
-    if (m_producer == nullptr)
-    {
-        return true;
-    }
-
-    for (auto ite = m_holdTrackers.begin(); ite != m_holdTrackers.end(); ite ++)
-    {
-        uint32_t index = ite->first;
-        volatile uint32_t latestTracker = *(m_producer->GetLatestTrackerAddress(index));
-        uint32_t holdTracker = ite->second;
-        if ((int)(holdTracker - latestTracker) > 0)
-        {
-            return false;
-        }
-    }
-    return true;
-}
-
-void FrameTrackerToken::Merge(const FrameTrackerToken *token)
-{
-    m_producer = token->m_producer;
-    for (auto ite = token->m_holdTrackers.begin(); ite != token->m_holdTrackers.end(); ite ++)
-    {
-        uint32_t index = ite->first;
-        uint32_t holdTracker = ite->second;
-        Merge(index, holdTracker);
-    }
-}
-
-FrameTrackerProducer::FrameTrackerProducer():
-    m_nextTrackerIndex(0),
-    m_resourceData(nullptr),
-    m_osInterface(nullptr)
-{
-    Mos_ResetResource(&m_resource);
-    MOS_ZeroMemory(m_trackerInUse, sizeof(m_trackerInUse));
-    MOS_ZeroMemory(m_counters, sizeof(m_counters));
-}
-
-FrameTrackerProducer::~FrameTrackerProducer()
-{
-    MOS_GFXRES_FREE_FLAGS resFreeFlags = {0};
-
-    resFreeFlags.AssumeNotInUse = 1;
-
-    if (!Mos_ResourceIsNull(&m_resource))
-    {
-        m_osInterface->pfnUnlockResource(
-                m_osInterface,
-                &m_resource);
-
-        m_osInterface->pfnFreeResourceWithFlag(
-            m_osInterface,
-            &m_resource,
-            resFreeFlags.Value);
-    }
-}
-
-MOS_STATUS FrameTrackerProducer::Initialize(MOS_INTERFACE *osInterface)
-{
-    m_osInterface = osInterface;
-    MHW_CHK_NULL_RETURN(m_osInterface);
-    
-    // allocate the resource
-    MOS_ALLOC_GFXRES_PARAMS allocParamsLinearBuffer;
-    uint32_t size = MOS_ALIGN_CEIL(MAX_TRACKER_NUMBER * m_trackerSize, MHW_CACHELINE_SIZE);
-    MOS_ZeroMemory(&allocParamsLinearBuffer, sizeof(MOS_ALLOC_GFXRES_PARAMS));
-    allocParamsLinearBuffer.Type     = MOS_GFXRES_BUFFER;
-    allocParamsLinearBuffer.TileType = MOS_TILE_LINEAR;
-    allocParamsLinearBuffer.Format   = Format_Buffer;
-    allocParamsLinearBuffer.dwBytes = size;
-    allocParamsLinearBuffer.pBufName = "FrameTrackerResource";
-
-    MHW_CHK_STATUS_RETURN(m_osInterface->pfnAllocateResource(
-        m_osInterface,
-        &allocParamsLinearBuffer,
-        &m_resource));
-
-    // RegisterResource will be called in AddResourceToHWCmd. It is not allowed to be called by hal explicitly for Async mode
-    if (MosInterface::IsAsyncDevice(m_osInterface->osStreamState) == false)
-    {
-        MHW_CHK_STATUS_RETURN(
-            m_osInterface->pfnRegisterResource(m_osInterface, &m_resource, true, true));
-    }
-    
-    // Lock the Resource
-    MOS_LOCK_PARAMS lockFlags;
-    MOS_ZeroMemory(&lockFlags, sizeof(MOS_LOCK_PARAMS));
-    lockFlags.ReadOnly = 1;
-    lockFlags.ForceCached = true;
-
-    m_resourceData = (uint32_t*)m_osInterface->pfnLockResource(
-        m_osInterface,
-        &m_resource,
-        &lockFlags);
-    MOS_ZeroMemory(m_resourceData, size);
-
-    m_osInterface->pfnSkipResourceSync(&m_resource);
-
-    MHW_CHK_NULL_RETURN(m_resourceData);
-
-    return MOS_STATUS_SUCCESS;
-}
-
-int FrameTrackerProducer::AssignNewTracker()
-{
-    uint32_t trackerIndex = m_nextTrackerIndex;
-    bool found = false;
-    do
-    {
-        if (!m_trackerInUse[trackerIndex])
-        {
-            found = true;
-            break;
-        }
-        else
-        {
-            ++ trackerIndex;
-            if (trackerIndex == MAX_TRACKER_NUMBER)
-            {
-                trackerIndex = 0;
-            }
-        }
-    }
-    while (trackerIndex != m_nextTrackerIndex);
-
-    if (found)
-    {
-        m_trackerInUse[trackerIndex] = true;
-        m_counters[trackerIndex] = 1;
-        m_nextTrackerIndex = trackerIndex + 1;
-        if (m_nextTrackerIndex == MAX_TRACKER_NUMBER)
-        {
-            m_nextTrackerIndex = 0;
-        }
-
-        return trackerIndex;
-    }
-    else
-    {
-        return -1;
-    }
-}
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/frame_tracker.h 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/frame_tracker.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/frame_tracker.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/frame_tracker.h	1970-01-01 00:00:00.000000000 +0000
@@ -1,185 +0,0 @@
-/*
-* Copyright (c) 2019, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     frame_tracker.h
-//! \brief    Manages the multiple trackers in one place.
-//!
-
-#ifndef __FRAME_TRACKER_H__
-#define __FRAME_TRACKER_H__
-
-#include "mos_os.h"
-#include <map>
-
-#define MAX_TRACKER_NUMBER 64
-#define CHK_INDEX(index) if ((index) >= MAX_TRACKER_NUMBER) {return MOS_STATUS_NOT_ENOUGH_BUFFER; }
-
-class FrameTrackerToken;
-class FrameTrackerProducer;
-
-// C-style struct for FrameTrackerToken
-// for tokens that embeded in a struct other than a class
-// in legacy DSH code, the token is always embeded in another struct
-struct FrameTrackerTokenFlat
-{
-    FrameTrackerProducer *producer;
-    uint32_t trackers[MAX_TRACKER_NUMBER];
-    bool valid;
-    bool stick;
-};
-
-bool FrameTrackerTokenFlat_IsExpired(const FrameTrackerTokenFlat *self);
-
-static inline void FrameTrackerTokenFlat_Merge(FrameTrackerTokenFlat *self, uint32_t index, uint32_t tracker)
-{
-    if (index < MAX_TRACKER_NUMBER && tracker != 0)
-    {
-        self->trackers[index] = tracker;
-    }
-}
-
-static inline void FrameTrackerTokenFlat_Merge(FrameTrackerTokenFlat *self, const FrameTrackerTokenFlat *token)
-{
-    self->producer = token->producer;
-    for (int i = 0; i < MAX_TRACKER_NUMBER; i++)
-    {
-        if (token->trackers[i] != 0)
-        {
-            FrameTrackerTokenFlat_Merge(self, i, token->trackers[i]);
-        }
-    }
-}
-
-static inline void FrameTrackerTokenFlat_SetProducer(FrameTrackerTokenFlat *self, FrameTrackerProducer *producer)
-{
-    self->producer = producer;
-}
-
-static inline void FrameTrackerTokenFlat_Clear(FrameTrackerTokenFlat *self)
-{
-    self->stick = false;
-    MOS_ZeroMemory(self->trackers, sizeof(self->trackers));
-}
-
-static inline void FrameTrackerTokenFlat_Validate(FrameTrackerTokenFlat *self)
-{
-    self->valid = true;
-}
-
-static inline void FrameTrackerTokenFlat_Invalidate(FrameTrackerTokenFlat *self)
-{
-    self->valid = false;
-}
-
-static inline bool FrameTrackerTokenFlat_IsValid(const FrameTrackerTokenFlat *self)
-{
-    return self->valid;
-}
-
-static inline void FrameTrackerTokenFlat_Stick(FrameTrackerTokenFlat *self)
-{
-    self->stick = true;
-}
-
-class FrameTrackerToken
-{
-public:
-    FrameTrackerToken():
-        m_producer(nullptr)
-    {
-    }
-
-    ~FrameTrackerToken()
-    {
-    }
-
-    bool IsExpired();
-
-    void Merge(const FrameTrackerToken *token);
-
-    inline void Merge(uint32_t index, uint32_t tracker) {m_holdTrackers[index] = tracker; }
-
-    inline void SetProducer(FrameTrackerProducer *producer)
-    {
-        m_producer = producer;
-    }
-
-    inline void Clear() {m_holdTrackers.clear(); }
-
-protected:
-    FrameTrackerProducer *m_producer;
-    std::map<uint32_t, uint32_t> m_holdTrackers;
-};
-
-class FrameTrackerProducer
-{
-public:
-    FrameTrackerProducer();
-    ~FrameTrackerProducer();
-
-    MOS_STATUS Initialize(MOS_INTERFACE *osInterface);
-
-    int AssignNewTracker();
-
-    inline void GetLatestTrackerResource(uint32_t index, MOS_RESOURCE **resource, uint32_t *offset)
-    {
-        *resource = &m_resource;
-        *offset = index * m_trackerSize;
-    }
-    
-    inline volatile uint32_t *GetLatestTrackerAddress(uint32_t index)
-    {
-        return (uint32_t *)((uint8_t *)m_resourceData + index * m_trackerSize);
-    }
-
-    inline uint32_t GetNextTracker(uint32_t index) { return m_counters[index];}
-
-    inline MOS_STATUS StepForward(uint32_t index)
-    {
-        CHK_INDEX(index);
-        ++ m_counters[index];
-        if (m_counters[index] == 0)
-        {
-            m_counters[index] = 1;
-        }
-        return MOS_STATUS_SUCCESS;
-    }
-
-protected:
-    // indexes to assign a new tracer
-    uint32_t m_nextTrackerIndex;
-    bool m_trackerInUse[MAX_TRACKER_NUMBER];
-
-    // resource
-    static const uint32_t m_trackerSize = 8; // reserved two dwords for each tracker
-    MOS_RESOURCE m_resource;
-    uint32_t *m_resourceData;
-
-    // counters
-    uint32_t m_counters[MAX_TRACKER_NUMBER];
-
-    // interfaces
-    MOS_INTERFACE *m_osInterface;
-};
-
-
-#endif // __FRAME_TRACKER_H__
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/heap.cpp 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/heap.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/heap.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/heap.cpp	1970-01-01 00:00:00.000000000 +0000
@@ -1,188 +0,0 @@
-/*
-* Copyright (c) 2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     heap.cpp
-//! \brief    Implements functionalities pertaining to heaps.
-//!
-
-#include "heap.h"
-
-Heap::Heap()
-{
-    HEAP_FUNCTION_ENTER;
-    m_id = m_invalidId;
-}
-
-Heap::Heap(uint32_t id)
-{
-    HEAP_FUNCTION_ENTER;
-    m_id = id;
-}
-
-Heap::~Heap()
-{
-    HEAP_FUNCTION_ENTER;
-    if (m_osInterface != nullptr)
-    {
-        if (m_lockedHeap != nullptr)
-        {
-            m_osInterface->pfnUnlockResource(m_osInterface, m_resource);
-        }
-        if (!Mos_ResourceIsNull(m_resource))
-        {
-            m_osInterface->pfnFreeResource(m_osInterface, m_resource);
-            MOS_FreeMemory(m_resource);
-        }
-    }
-}
-
-MOS_STATUS Heap::RegisterOsInterface(PMOS_INTERFACE osInterface)
-{
-    HEAP_FUNCTION_ENTER;
-    HEAP_CHK_NULL(osInterface);
-    m_osInterface = osInterface;
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS Heap::Allocate(uint32_t heapSize, bool keepLocked)
-{
-    HEAP_FUNCTION_ENTER;
-
-    if (heapSize == 0)
-    {
-        HEAP_ASSERTMESSAGE("No size requested for heap allocation!");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (m_resource != nullptr)
-    {
-        HEAP_ASSERTMESSAGE("A heap has already been allocated!");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    m_resource = (PMOS_RESOURCE)MOS_AllocAndZeroMemory(sizeof(MOS_RESOURCE));
-    HEAP_CHK_NULL(m_resource);
-    HEAP_CHK_NULL(m_osInterface);
-
-    MOS_ALLOC_GFXRES_PARAMS allocParams;
-    memset(&allocParams, 0, sizeof(allocParams));
-    allocParams.Type = MOS_GFXRES_BUFFER;
-    allocParams.TileType = MOS_TILE_LINEAR;
-    allocParams.Format = Format_Buffer;
-    allocParams.dwBytes = heapSize;
-    allocParams.pBufName = "Heap";
-
-    if (m_hwWriteOnly && !keepLocked)
-    {
-        allocParams.Flags.bNotLockable = true;
-        allocParams.dwMemType = MOS_MEMPOOL_DEVICEMEMORY;
-    }
-
-    HEAP_CHK_STATUS(m_osInterface->pfnAllocateResource(
-        m_osInterface,
-        &allocParams,
-        m_resource));
-
-    // explicit set to skip resource sync, heap resource should be used block by block
-    // driver should ensure non concurrent access the same block
-    HEAP_CHK_STATUS(m_osInterface->pfnSkipResourceSync(m_resource));
-
-    if (keepLocked)
-    {
-        m_lockedHeap = Lock();
-        HEAP_CHK_NULL(m_lockedHeap);
-        m_keepLocked = keepLocked;
-    }
-
-    m_size = heapSize;
-    m_freeSpace = m_size;
-
-    return MOS_STATUS_SUCCESS;
-}
-
-uint8_t* Heap::Lock()
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-    if (m_keepLocked)
-    {
-        return m_lockedHeap;
-    }
-
-    if (m_osInterface == nullptr)
-    {
-        HEAP_ASSERTMESSAGE("Invalid m_osInterface(nullptr)");
-        return nullptr;
-    }
-
-    MOS_LOCK_PARAMS lockParams;
-    memset(&lockParams, 0, sizeof(lockParams));
-    lockParams.WriteOnly = 1;
-    lockParams.NoOverWrite = 1;
-    lockParams.Uncached = 1;
-    uint8_t* pLockedResource =
-        (uint8_t*)m_osInterface->pfnLockResource(m_osInterface, m_resource, &lockParams);
-    return pLockedResource;
-}
-
-MOS_STATUS Heap::Dump()
-{
-    return MOS_STATUS_UNIMPLEMENTED;
-}
-
-MOS_STATUS Heap::AdjustFreeSpace(uint32_t addedSpace)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (addedSpace + m_freeSpace > m_size ||
-        m_usedSpace < addedSpace)
-    {
-        HEAP_ASSERTMESSAGE("Provided space will not fit in the heap");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    m_freeSpace += addedSpace;
-    m_usedSpace -= addedSpace;
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS Heap::AdjustUsedSpace(uint32_t addedSpace)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (addedSpace + m_usedSpace > m_size ||
-        m_freeSpace < addedSpace)
-    {
-        HEAP_ASSERTMESSAGE("Provided space will not fit in the heap");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (m_freeInProgress)
-    {
-        HEAP_ASSERTMESSAGE("Heap is in the process of being freed, cannot add space as used");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    m_freeSpace -= addedSpace;
-    m_usedSpace += addedSpace;
-
-    return MOS_STATUS_SUCCESS;
-}
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/heap.h 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/heap.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/heap.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/heap.h	1970-01-01 00:00:00.000000000 +0000
@@ -1,243 +0,0 @@
-/*
-* Copyright (c) 2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     heap.h
-//! \brief    A heap is a buffer in graphics memory in which the driver may store information
-//! \details  Heaps are created for the client via the heap manager, through which the client
-//!           is expected to claim blocks of memory for data storage. The client has no direct
-//!           access to the heap.
-//!
-
-#ifndef __HEAP_H__
-#define __HEAP_H__
-
-#include "mos_os.h"
-#include "mos_util_debug.h"
-
-//! Evaluates the status and returns if failure
-#define HEAP_CHK_STATUS(_stmt)                                               \
-    MOS_CHK_STATUS_RETURN(MOS_COMPONENT_HW, MOS_HW_SUBCOMP_ALL, _stmt)
-//! Checks the pointer and returns if nullptr
-#define HEAP_CHK_NULL(_ptr)                                                  \
-    MOS_CHK_NULL_RETURN(MOS_COMPONENT_HW, MOS_HW_SUBCOMP_ALL, _ptr)
-//! Asserts and prints \a _message at critical message level
-#define HEAP_ASSERTMESSAGE(_message, ...)                                                 \
-    MOS_ASSERTMESSAGE(MOS_COMPONENT_HW, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
-//! Prints \a _message at normal message level
-#define HEAP_NORMALMESSAGE(_message, ...)                                                 \
-    MOS_NORMALMESSAGE(MOS_COMPONENT_HW, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
-//! Prints \a _message at verbose message level
-#define HEAP_VERBOSEMESSAGE(_message, ...)                                                \
-    MOS_VERBOSEMESSAGE(MOS_COMPONENT_HW, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__)
-//! Prints the function name at function enter message level
-#define HEAP_FUNCTION_ENTER                                                               \
-    MOS_FUNCTION_ENTER(MOS_COMPONENT_HW, MOS_SUBCOMP_SELF)
-//! Prints the function name at verbose function enter message level
-#define HEAP_FUNCTION_ENTER_VERBOSE                                                       \
-    MOS_FUNCTION_ENTER_VERBOSE(MOS_COMPONENT_HW, MOS_SUBCOMP_SELF)
-
-//! \brief Generic heap for storing client written data in graphics memory
-class Heap
-{
-    friend class MemoryBlockInternal;
-    friend class MemoryBlockManager;
-
-public:
-    //!
-    //! \brief  Default constructor
-    //!         Identifier for the heap
-    //!  
-    Heap();
-
-    //!
-    //! \brief    Copy constructor
-    //!
-    Heap(const Heap&) = delete;
-
-    //!
-    //! \brief    Copy assignment operator
-    //!
-    Heap& operator=(const Heap&) = delete;
-
-    //!
-    //! \brief  Constructor
-    //! \param  [in] id
-    //!         Identifier for the heap
-    //!  
-    Heap(uint32_t id);
-    virtual ~Heap();
-
-    //!  
-    //! \brief  Dumps the contents of the heap
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!  
-    MOS_STATUS Dump();
-
-    //!
-    //! \brief  Checks heap for validity
-    //! \return bool
-    //!         true if the heap is valid and false if not
-    //!
-    bool IsValid() { return (m_size > 0); }
-
-    //!
-    //! \brief  Gets the graphics resource for the heap
-    //! \param  [out] resource
-    //!         Container for the output graphics resource
-    //! \return MOS_RESOURCE*
-    //!         Valid pointer if success, nullptr for any fail
-    //!
-    MOS_RESOURCE* GetResource()
-    {
-        HEAP_FUNCTION_ENTER_VERBOSE;
-        if (m_size && !Mos_ResourceIsNull(m_resource))
-        {
-            return m_resource;
-        }
-        HEAP_ASSERTMESSAGE("Resource is not valid");
-        return nullptr;
-    }
-
-    //!
-    //! \brief  Gets the size of the heap
-    //! \return The size of the heap \see m_size
-    //!
-    uint32_t GetSize() { return m_size; }
-
-    //!
-    //! \brief  Gets the used size of the heap
-    //! \return The amount of space used in the heaps \see m_usedSize
-    //!
-    uint32_t GetUsedSize() { return m_usedSpace; }
-
-    //!
-    //! \brief  Gets the ID for the heap
-    //! \return The Heap ID \see m_id
-    //!
-    uint32_t GetId() { return m_id; }
-
-    //!
-    //! \brief  Whether or not the heap has been marked for freeing.
-    //! \return If the heap is being freed \see m_freeInProgress
-    //!  
-    bool IsFreeInProgress() { return m_freeInProgress; }
-
-    //! \brief Invalid heap ID.
-    static const uint8_t m_invalidId = 0;
-
-    //!
-    //! \brief  Mark the heap as hardware write only heap or not
-    void SetHeapHwWriteOnly(bool isHwWriteOnly) { m_hwWriteOnly = isHwWriteOnly; }
-
-protected:
-    //!
-    //! \brief  Stores the provided OS interface in the heap
-    //! \param  [in] osInterface
-    //!         Must be valid
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!  
-    MOS_STATUS RegisterOsInterface(PMOS_INTERFACE osInterface);
-
-    //!
-    //! \brief  Allocates a graphics resource of size \a heapSize
-    //! \param  [in] heapSize
-    //!         The size of the state heap, must be non-zero
-    //! \param  [in] keepLocked
-    //!         Locks the heap when allocated and does not unlock it until it is destroyed
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!  
-    MOS_STATUS Allocate(uint32_t heapSize, bool keepLocked);
-
-    //!
-    //! \brief  Locks the heap asynchonously
-    //! \return uint8_t*
-    //!         If successful, pointer to data in the heap resource; if failed, nullptr \see m_resource
-    //!  
-    uint8_t* Lock();
-
-    //!
-    //! \brief  Unlocks the heap
-    //!  
-    void Unlock()
-    {
-        HEAP_FUNCTION_ENTER_VERBOSE;
-        if (!m_keepLocked)
-        {
-            if (m_osInterface == nullptr)
-            {
-                HEAP_ASSERTMESSAGE("Invalid m_osInterface(nullptr)");
-                return;
-            }
-
-            m_osInterface->pfnUnlockResource(m_osInterface, m_resource);
-        }
-    }
-
-    //!
-    //! \brief  Prepares the heap for being freed which will occur when all blocks are
-    //!         no longer in use.
-    //!  
-    void PrepareForFree()
-    {
-        HEAP_FUNCTION_ENTER;
-        m_freeInProgress = true;
-    }
-
-    //!
-    //! \brief  Adjusts the free space in the heap. 
-    //! \param  [in] addedSpace
-    //!         Space to be added and subtracted from the free and used space
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //! 
-    MOS_STATUS AdjustFreeSpace(uint32_t addedSpace);
-
-    //!
-    //! \brief  Adjusts the used space in the heap. 
-    //! \param  [in] addedSpace
-    //!         Space to be added and subtracted from the free and used space
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //! 
-    MOS_STATUS AdjustUsedSpace(uint32_t addedSpace);
-
-private:
-    //! \brief Indicates that the heap is in the process of being freed
-    bool m_freeInProgress = false;
-    bool m_keepLocked = false;          //!< Indictaes that heap is kept locked until freed.
-    PMOS_RESOURCE m_resource = nullptr; //!< Graphics resource for the heap.
-    uint32_t m_size = 0;                //!< The size of the heap.
-    //! \brief   Pointer to the locked heap data.
-    //! \details This pointer is only valid if the heap is locked always
-    uint8_t *m_lockedHeap = nullptr;
-    uint32_t m_freeSpace = 0;           //!< The amount of space available in the heap
-    uint32_t m_usedSpace = 0;           //!< The amount of used space within the heap
-    //! \brief OS interface used for managing graphics resources
-    PMOS_INTERFACE m_osInterface = nullptr;
-    //! \brief unique identifier for the heap within the heap manager
-    uint32_t m_id = m_invalidId;
-    bool m_hwWriteOnly = false;            //!< Indictaes that heap is used by hardware write only.
-};
-#endif // __HEAP_H__
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/heap_manager.cpp 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/heap_manager.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/heap_manager.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/heap_manager.cpp	1970-01-01 00:00:00.000000000 +0000
@@ -1,268 +0,0 @@
-/*
-* Copyright (c) 2017-2021, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     heap_manager.cpp
-//! \brief    Implements functionalities pertaining to the heap manager.
-//!
-
-#include "heap_manager.h"
-
-HeapManager::~HeapManager()
-{
-    HEAP_FUNCTION_ENTER;
-    m_currHeapId = 0;
-    m_currHeapSize = 0;
-    m_extendHeapSize = 0;
-    m_osInterface = nullptr;
-}
-
-MOS_STATUS HeapManager::AcquireSpace(
-    MemoryBlockManager::AcquireParams &params,
-    std::vector<MemoryBlock> &blocks,
-    uint32_t &spaceNeeded)
-{
-    HEAP_FUNCTION_ENTER;
-
-    // first time space is being acquired, allocate the first heap
-    if (m_heapIds.empty())
-    {
-        HEAP_CHK_STATUS(AllocateHeap(m_currHeapSize));
-    }
-
-    if (m_behavior != Behavior::clientControlled)
-    {
-        if (params.m_staticBlock)
-        {
-            HEAP_ASSERTMESSAGE("Static blocks are only allowed when the client controls behavior");
-            return MOS_STATUS_INVALID_PARAMETER;
-        }
-        if (!m_blockManager.IsTrackerDataValid())
-        {
-            HEAP_ASSERTMESSAGE("A tracker must be registered before acquiring space if client does not control behavior");
-            return MOS_STATUS_INVALID_PARAMETER;
-        }
-    }
-
-    spaceNeeded = 0;
-    MOS_STATUS acquireSpaceResult = m_blockManager.AcquireSpace(params, blocks, spaceNeeded);
-    if (acquireSpaceResult == MOS_STATUS_CLIENT_AR_NO_SPACE)
-    {
-        bool blocksUpdated = false;
-        // no need to refresh the block states for every space acquisition
-        // attempt for first AcquireSpace failure
-        HEAP_CHK_STATUS(m_blockManager.RefreshBlockStates(blocksUpdated));
-        if (blocksUpdated)
-        {
-            if ((m_blockManager.AcquireSpace(params, blocks, spaceNeeded)) ==
-                MOS_STATUS_CLIENT_AR_NO_SPACE)
-            {
-                // if space may not be acquired after refreshing block states, execute behavior
-                HEAP_CHK_STATUS(BehaveWhenNoSpace());
-                HEAP_CHK_STATUS(m_blockManager.AcquireSpace(params, blocks, spaceNeeded));
-            }
-        }
-        else
-        {
-            // if no blocks updated after refresh, execute behavior
-            HEAP_CHK_STATUS(BehaveWhenNoSpace());
-            HEAP_CHK_STATUS(m_blockManager.AcquireSpace(params, blocks, spaceNeeded));
-        }
-    }
-    else
-    {
-        HEAP_CHK_STATUS(acquireSpaceResult);
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS HeapManager::ClearSpace(MemoryBlock &block)
-{
-    HEAP_FUNCTION_ENTER;
-
-    if (m_behavior != clientControlled)
-    {
-        HEAP_ASSERTMESSAGE("Only client controlled behavior allows for clients to clear space");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    HEAP_CHK_STATUS(m_blockManager.ClearSpace(block))
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS HeapManager::RegisterTrackerResource(uint32_t *trackerData)
-{
-    HEAP_FUNCTION_ENTER;
-    return m_blockManager.RegisterTrackerResource(trackerData);
-}
-
-MOS_STATUS HeapManager::RegisterTrackerProducer(FrameTrackerProducer *trackerProducer)
-{
-    HEAP_FUNCTION_ENTER;
-    return m_blockManager.RegisterTrackerProducer(trackerProducer);
-}
-
-MOS_STATUS HeapManager::SetInitialHeapSize(uint32_t size)
-{
-    HEAP_FUNCTION_ENTER;
-
-    if (size == 0)
-    {
-        HEAP_ASSERTMESSAGE("0 is an invalid size for heap extension");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    m_currHeapSize = MOS_ALIGN_CEIL(size, m_heapAlignment);
-
-    return MOS_STATUS_SUCCESS;
-}
-
-
-MOS_STATUS HeapManager::SetExtendHeapSize(uint32_t size)
-{
-    HEAP_FUNCTION_ENTER;
-
-    if (size == 0)
-    {
-        HEAP_ASSERTMESSAGE("0 is an invalid size for heap extension");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (m_behavior == Behavior::wait)
-    {
-        HEAP_ASSERTMESSAGE("The heap may not be extended in the case of wait behavior");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    m_extendHeapSize = MOS_ALIGN_CEIL(size, m_heapAlignment);
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS HeapManager::RegisterOsInterface(PMOS_INTERFACE osInterface)
-{
-    HEAP_FUNCTION_ENTER;
-    HEAP_CHK_NULL(osInterface);
-    m_osInterface = osInterface;
-    HEAP_CHK_STATUS(m_blockManager.RegisterOsInterface(m_osInterface));
-    return MOS_STATUS_SUCCESS;
-}
-
-uint32_t HeapManager::GetTotalSize()
-{
-    HEAP_FUNCTION_ENTER;
-
-    uint32_t totalSize = m_blockManager.GetSize();
-
-    // Since allocation is delayed to when space is acquired, it is possible
-    // for manager to be in a valid state if a size of 0 is returned. 
-    if (totalSize == 0 && m_currHeapId == Heap::m_invalidId)
-    {
-        totalSize = m_currHeapSize;
-    }
-
-    return totalSize;
-}
-
-MOS_STATUS HeapManager::AllocateHeap(uint32_t size)
-{
-    HEAP_FUNCTION_ENTER;
-
-    HEAP_CHK_NULL(m_osInterface);
-
-    if (size == 0)
-    {
-        HEAP_ASSERTMESSAGE("0 is an invalid size for heap allocation");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    ++m_currHeapId;
-    m_heapIds.push_back(m_currHeapId);
-
-    HEAP_CHK_STATUS(m_blockManager.RegisterHeap(m_currHeapId, size, m_hwWriteOnlyHeap));
-
-    return MOS_STATUS_SUCCESS;
-}
-
-void HeapManager::FreeHeap()
-{
-    // Free oldest heap
-    auto heapId = m_heapIds.front();
-    m_heapIds.pop_front();
-    m_blockManager.UnregisterHeap(heapId);
-}
-
-MOS_STATUS HeapManager::Wait()
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    bool blocksUpdated = false;
-
-    for (auto waitMs = m_waitTimeout; waitMs > 0; waitMs -= m_waitIncrement)
-    {
-        MosUtilities::MosSleep(m_waitIncrement);
-        HEAP_CHK_STATUS(m_blockManager.RefreshBlockStates(blocksUpdated));
-        if (blocksUpdated)
-        {
-            break;
-        }
-    }
-
-    return (blocksUpdated) ? MOS_STATUS_SUCCESS : MOS_STATUS_CLIENT_AR_NO_SPACE;
-}
-
-MOS_STATUS HeapManager::BehaveWhenNoSpace()
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    switch (m_behavior)
-    {
-        case wait:
-            HEAP_CHK_STATUS(Wait());
-            break;
-        case extend:
-            m_currHeapSize += m_extendHeapSize;
-            HEAP_CHK_STATUS(AllocateHeap(m_currHeapSize));
-            break;
-        case destructiveExtend:
-            FreeHeap();
-            m_currHeapSize += m_extendHeapSize;
-            HEAP_CHK_STATUS(AllocateHeap(m_currHeapSize));
-            break;
-        case waitAndExtend:
-            if (Wait() == MOS_STATUS_CLIENT_AR_NO_SPACE)
-            {
-                m_currHeapSize += m_extendHeapSize;
-                HEAP_CHK_STATUS(AllocateHeap(m_currHeapSize));
-            }
-            break;
-        case clientControlled:
-            // heap manager gives control back to the client
-            return MOS_STATUS_CLIENT_AR_NO_SPACE;
-        default:
-            HEAP_ASSERTMESSAGE("The requested behavior is not yet implemented");
-            return MOS_STATUS_UNIMPLEMENTED;
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/heap_manager.h 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/heap_manager.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/heap_manager.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/heap_manager.h	1970-01-01 00:00:00.000000000 +0000
@@ -1,247 +0,0 @@
-/*
-* Copyright (c) 2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     heap_manager.h
-//! \brief    The client facing interface for handling heaps.
-//!
-
-#ifndef __HEAP_MANAGER_H__
-#define __HEAP_MANAGER_H__
-
-#include "memory_block_manager.h"
-
-class FrameTrackerProducer;
-
-//! \brief Client accessible manager for heaps.
-class HeapManager
-{
-
-public:
-    //! \brief Expected behavior when space is not available in the heap(s)
-    enum Behavior
-    {
-        wait = 0,           //<! Waits for space to become available.
-        extend,             //<! Allocates a new heap of the existing size + the default extend heap size.
-        destructiveExtend,  //<! Performs the same action as extend and marks the old heap for delete.
-        waitAndExtend,      //<! Waits for a fixed amount of time and then performs an extend if a timeout occurs.
-        clientControlled    //<! If space is not available, heap manager returns so client can decide what to do
-    };
-
-    HeapManager()
-    {
-        HEAP_FUNCTION_ENTER;
-    }
-    virtual ~HeapManager();
-
-    //!
-    //! \brief  Acquires space within the heap(s)
-    //! \param  [in] params
-    //!         Parameters describing the requested space
-    //! \param  [out] blocks
-    //!         A vector containing the memory blocks allocated
-    //! \param  [out] spaceNeeded
-    //!         Amount of space that the heap(s) are short of to complete space acquisition
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS AcquireSpace(
-        MemoryBlockManager::AcquireParams &params,
-        std::vector<MemoryBlock> &blocks,
-        uint32_t &spaceNeeded);
-
-    //!
-    //! \brief  Indicates that the client is done editing the blocks
-    //! \param  [in] blocks
-    //!         Blocks to be submitted
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS SubmitBlocks(std::vector<MemoryBlock> &blocks)
-    {
-        return m_blockManager.SubmitBlocks(blocks);
-    }
-
-    //!
-    //! \brief   Makes a block available in the heap.
-    //! \details Expected to be used only when the behavior selected in HeapManager is client
-    //!          controlled--the client wants direct control over what is removed from the heap
-    //!          (static blocks would be used in this case).
-    //! \param   [in] block
-    //!          Block to be removed
-    //! \return  MOS_STATUS
-    //!          MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS ClearSpace(MemoryBlock &block);
-
-    //!
-    //! \brief  Registers the tracker data to be used for determining whether a
-    //!         memory block is available.
-    //! \param  [in] trackerData
-    //!         Must be valid; pointer to tracker data. \see MemoryBlockManager::m_trackerData.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS RegisterTrackerResource(uint32_t *trackerData);
-
-    //!
-    //! \brief  Registers the tracker producer to be used for determining whether a
-    //!         memory block is available. This function has a higher priority than
-    //!         RegisterTrackerResource, so if it is called, the trackerResource will
-    //!         be useless.
-    //! \param  [in] trackerProducer
-    //!         Must be valid; pointer to trackerProducer.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS RegisterTrackerProducer(FrameTrackerProducer *trackerProducer);
-
-    //!
-    //! \brief  Updates the default behavior of the heap manager
-    //! \param  [in] behavior
-    //!         Expected behavior of the heap mamanger
-    //!
-    void SetDefaultBehavior(Behavior behavior)
-    { 
-        HEAP_FUNCTION_ENTER;
-        if (behavior > clientControlled)
-        {
-            behavior = wait;
-        }
-        m_behavior = behavior;
-    }
-
-    //!
-    //! \brief  Updates the initial heap size either for first allocation or for extension
-    //! \param  [in] size
-    //!         Updates the current heap size, must be non-zero. \see m_currHeapSize
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS SetInitialHeapSize(uint32_t size);
-
-    //!
-    //! \brief  Updates the extend heap size when the behavior is not to wait. \see m_behavior \see Behavior::wait
-    //! \param  [in] size
-    //!         Updates the extend heap size, must be non-zero. \see m_extendHeapSize
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS SetExtendHeapSize(uint32_t size);
-
-    //!
-    //! \brief  Stores the provided OS interface in the heap
-    //! \param  [in] osInterface
-    //!         Must be valid
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!  
-    MOS_STATUS RegisterOsInterface(PMOS_INTERFACE osInterface);
-
-    //!
-    //! \brief  Indicates the total size of all managed heaps
-    //! \return The size of all heaps managed \see m_totalSizeOfHeaps
-    //!  
-    uint32_t GetTotalSize();
-
-    //!
-    //! \brief  Indicates the size of heap extensions
-    //! \return The size by which heaps are extended by \see m_extendHeapSize
-    //!  
-    uint32_t GetExtendSize()
-    {
-        HEAP_FUNCTION_ENTER;
-        return m_extendHeapSize;
-    }
-
-    //!
-    //! \brief   All heaps allocated are locked and kept locked for their lifetimes
-    //! \details May only be set before any heaps are allocated.
-    //! \return  MOS_STATUS
-    //!          MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS LockHeapsOnAllocate()
-    {
-        HEAP_FUNCTION_ENTER;
-        return m_blockManager.LockHeapsOnAllocate();
-    }
-
-    //!
-    //! \brief  Mark the heap as hardware write only heap or not
-    void SetHwWriteOnlyHeap(bool isHwWriteOnlyHeap) { m_hwWriteOnlyHeap = isHwWriteOnlyHeap; }
-
-private:
-    //!
-    //! \brief  Allocates a heap of requested size
-    //! \param  [in] size
-    //!         Size of the heap to be allocated
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS AllocateHeap(uint32_t size);
-
-    //!
-    //! \brief  Free or attempts to free a heap
-    //!
-    void FreeHeap();
-
-    //!
-    //! \brief  Wait for for space to be available in the heap
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS Wait();
-
-    //!
-    //! \brief  If space may not be acquired, behave according to the current specified behavior.
-    //!         \see m_behavior \see MemoryBlockManager::AcquireSpace
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS BehaveWhenNoSpace();
-
-    //! \brief Alignment used for the heap size during allocation
-    static const uint32_t m_heapAlignment = MOS_PAGE_SIZE;
-    //! \brief Timeout in milliseconds for wait, currently fixed
-    static const uint32_t m_waitTimeout = 100;
-    //! \brief Wait increment in milliseconds, currently fixed
-    static const uint32_t m_waitIncrement = 10;
-
-    //! \brief Memory block manager for the heap(s)
-    MemoryBlockManager m_blockManager;
-    //! \brief The default behavior when space is not found in any of the heaps.
-    Behavior m_behavior = Behavior::wait;
-    //! \brief Current heap ID
-    uint32_t m_currHeapId = Heap::m_invalidId;
-    //! \brief The current heap size
-    uint32_t m_currHeapSize = 0;
-    //! \brief The size by which a heap is expected to be extended by when the behavior
-    //!        is extend.
-    uint32_t m_extendHeapSize = 0;
-    //! \brief Stores the IDs for the heaps stored in the memory block manager
-    std::list<uint32_t> m_heapIds;
-    //! \brief OS interface used for managing graphics resources
-    PMOS_INTERFACE m_osInterface = nullptr;
-    //!< Indictaes that heap is used by hardware write only.
-    bool m_hwWriteOnlyHeap = false;
-};
-
-#endif // __HEAP_MANAGER_H__
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/media_srcs.cmake 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/media_srcs.cmake
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/media_srcs.cmake	1970-01-01 00:00:00.000000000 +0000
@@ -1,60 +0,0 @@
-# Copyright (c) 2017, Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-
-set(TMP_SOURCES_
-    ${CMAKE_CURRENT_LIST_DIR}/heap.cpp
-    ${CMAKE_CURRENT_LIST_DIR}/heap_manager.cpp
-    ${CMAKE_CURRENT_LIST_DIR}/memory_block.cpp
-    ${CMAKE_CURRENT_LIST_DIR}/memory_block_manager.cpp
-    ${CMAKE_CURRENT_LIST_DIR}/frame_tracker.cpp
-)
-
-set(TMP_HEADERS_
-    ${CMAKE_CURRENT_LIST_DIR}/heap.h
-    ${CMAKE_CURRENT_LIST_DIR}/heap_manager.h
-    ${CMAKE_CURRENT_LIST_DIR}/memory_block.h
-    ${CMAKE_CURRENT_LIST_DIR}/memory_block_manager.h
-    ${CMAKE_CURRENT_LIST_DIR}/frame_tracker.h
-)
-
-set(SOURCES_
-    ${SOURCES_}
-    ${TMP_SOURCES_}
- )
-
-set(HEADERS_
-    ${HEADERS_}
-    ${TMP_HEADERS_}
-)
-
-set(COMMON_SOURCES_
-    ${COMMON_SOURCES_}
-    ${TMP_SOURCES_}
-)
-
-set(COMMON_HEADERS_
-    ${COMMON_HEADERS_}
-    ${TMP_HEADERS_}
-)
-
-source_group( "Common Files" FILES ${TMP_SOURCES_} ${TMP_HEADERS_} )
-
-
-media_add_curr_to_include_path()
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/memory_block.cpp 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/memory_block.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/memory_block.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/memory_block.cpp	1970-01-01 00:00:00.000000000 +0000
@@ -1,540 +0,0 @@
-/*
-* Copyright (c) 2017-2021, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     memory_block.cpp
-//! \brief    Implements functionalities pertaining to memory blocks
-//!
-
-#include "memory_block.h"
-#include "heap.h"
-
-MOS_STATUS MemoryBlockInternal::AddData(
-    void* data,
-    uint32_t dataOffset,
-    uint32_t dataSize,
-    bool zeroBlock)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (m_state != allocated)
-    {
-        HEAP_ASSERTMESSAGE("Memory blocks may only have data added while in allocated state");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (data == nullptr && !zeroBlock)
-    {
-        HEAP_ASSERTMESSAGE("No data was passed in to be added");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (m_offset + dataOffset + dataSize > m_heap->GetSize() ||
-        dataOffset + dataSize > m_size)
-    {
-        HEAP_ASSERTMESSAGE("Data will not fit within the this memory block or state heap");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    uint8_t *lockedResource = m_heap->Lock();
-    HEAP_CHK_NULL(lockedResource);
-    lockedResource += m_offset + dataOffset;
-
-    if (zeroBlock)
-    {
-        memset(lockedResource, 0, m_size);
-    }
-    else
-    {
-        MOS_SecureMemcpy(
-            lockedResource,
-            m_size - dataOffset,
-            data,
-            dataSize);
-    }
-
-    m_heap->Unlock();
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockInternal::ReadData(
-    void* data,
-    uint32_t dataOffset,
-    uint32_t dataSize)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (data == nullptr)
-    {
-        HEAP_ASSERTMESSAGE("Pointer for data to be read back must be valid");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (m_offset + dataOffset + dataSize > m_heap->GetSize() ||
-        dataOffset + dataSize > m_size)
-    {
-        HEAP_ASSERTMESSAGE("Data attempting to read is outside this memory block or state heap");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    uint8_t *lockedResource = m_heap->Lock();
-    HEAP_CHK_NULL(lockedResource);
-    lockedResource += m_offset + dataOffset;
-
-    MOS_SecureMemcpy(
-        data,
-        dataSize,
-        lockedResource,
-        dataSize);
-
-    m_heap->Unlock();
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockInternal::Dump(
-    std::string filename,
-    uint32_t offset,
-    uint32_t size,
-    bool dumpInBinary)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (m_state != allocated && m_state != submitted)
-    {
-        HEAP_ASSERTMESSAGE("Memory blocks not in allocated or submitted state do not containe valid data");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    size = size ? size : m_size;
-
-    if (m_offset + offset + size > m_heap->GetSize() ||
-        offset + size > m_size)
-    {
-        HEAP_ASSERTMESSAGE("Data will not fit within the this memory block or state heap");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    uint8_t *lockedResource = m_heap->Lock();
-    HEAP_CHK_NULL(lockedResource);
-    lockedResource += offset + m_offset;
-    if (dumpInBinary)
-    {
-        HEAP_CHK_STATUS(MosUtilities::MosWriteFileFromPtr(
-            filename.c_str(),
-            lockedResource,
-            size));
-    }
-    else
-    {
-        uint32_t *lockedResourceIn4Bytes = (uint32_t*)lockedResource;
-        uint32_t sizeIn32BitHex = size / sizeof(uint32_t);
-        uint32_t sizeOfLastHex = size % sizeof(uint32_t);
-        std::string formattedData = "";
-        char dataInHex[10] = {0};
-
-        for (uint32_t i = 0; i < sizeIn32BitHex; i++)
-        {
-            MOS_SecureStringPrint(
-                dataInHex,
-                sizeof(dataInHex),
-                sizeof(dataInHex),
-                "%.8x ",
-                lockedResourceIn4Bytes[i]);
-            formattedData += dataInHex;
-            if (i % 4 == 3)
-            {
-                formattedData += "\r\n";
-            }
-        }
-
-        if (sizeOfLastHex > 0) // one last incomplete dword to print out
-        {
-            uint32_t lastHex = lockedResourceIn4Bytes[sizeIn32BitHex];
-            lastHex = lastHex & ((4 - sizeOfLastHex) * 8);
-
-            MOS_SecureStringPrint(dataInHex, sizeof(dataInHex), sizeof(dataInHex), "%.8x ", lastHex);
-            formattedData += dataInHex;
-        }
-
-        HEAP_CHK_STATUS(MosUtilities::MosWriteFileFromPtr(
-            filename.c_str(),
-            (void*)formattedData.c_str(),
-            formattedData.size()));
-    }
-
-    m_heap->Unlock();
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockInternal::Create(
-    Heap *heap,
-    State requestedState,
-    MemoryBlockInternal *prev,
-    uint32_t offset,
-    uint32_t size,
-    uint32_t trackerId)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    HEAP_CHK_NULL(prev);
-
-    if (m_state == State::deleted)
-    {
-        HEAP_ASSERTMESSAGE("Deleted blocks may not be re-used.");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (heap == nullptr)
-    {
-        HEAP_ASSERTMESSAGE("Heap pointer is not valid");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    else if (!heap->IsValid())
-    {
-        HEAP_ASSERTMESSAGE("Heap is not valid");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (offset + size > heap->GetSize())
-    {
-        HEAP_ASSERTMESSAGE("Data will not fit within the state heap");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    m_heap = heap;
-    m_offset = offset;
-    m_size = size;
-
-    if (requestedState == State::free)
-    {
-        HEAP_CHK_STATUS(Free());
-    }
-    else if (requestedState == State::allocated)
-    {
-        HEAP_CHK_STATUS(Allocate(trackerId));
-    }
-    else
-    {
-        HEAP_ASSERTMESSAGE("Only free and allocated blocks can be created");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    m_prev = prev;
-    m_next = prev->m_next;
-    prev->m_next = this;
-    auto next = GetNext();
-    if (next)
-    {
-        next->m_prev = this;
-    }
-
-    // expected to be inserted into a sorted list by MemoryBlockManager
-    m_statePrev = m_stateNext = nullptr;
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockInternal::Combine(MemoryBlockInternal *block)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    HEAP_CHK_NULL(block);
-
-    if (block->m_state != State::free || m_state != State::free)
-    {
-        HEAP_ASSERTMESSAGE("Only free blocks may be combined");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_static)
-    {
-        HEAP_ASSERTMESSAGE("Static blocks may not be modified");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    auto currPrev = GetPrev();
-    auto currNext = GetNext();
-    if (currPrev == block)
-    {
-        m_offset = block->m_offset;
-        m_prev = block->m_prev;
-        currPrev = GetPrev();
-        if (currPrev)
-        {
-            currPrev->m_next = this;
-        }
-    }
-    else if (currNext == block)
-    {
-        m_next = block->m_next;
-        currNext = GetNext();
-        if (currNext)
-        {
-            currNext->m_prev = this;
-        }
-    }
-    else
-    {
-        HEAP_ASSERTMESSAGE("Only adjacent blocks may be combined");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    m_size += block->m_size;
-    block->Pool();
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockInternal::Split(MemoryBlockInternal *block, uint32_t size)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    HEAP_CHK_NULL(block);
-
-    if (size == 0 || m_size == size)
-    {
-        HEAP_ASSERTMESSAGE("It is not possible to split a block if the new block has no size");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (m_state != State::free)
-    {
-        HEAP_ASSERTMESSAGE("Only free blocks may be resized");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_static)
-    {
-        HEAP_ASSERTMESSAGE("Static blocks may not be modified");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    uint32_t newBlockSize = m_size - size;
-    HEAP_CHK_STATUS(block->Create(
-        m_heap,
-        State::free,
-        this,
-        m_offset + size,
-        newBlockSize,
-        m_invalidTrackerId));
-
-    m_size = size;
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockInternal::Pool()
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (m_state == State::allocated || m_state == State::submitted)
-    {
-        HEAP_ASSERTMESSAGE("Allocated and submitted blocks may not be added to the pool");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_stateListType != State::stateCount)
-    {
-        HEAP_ASSERTMESSAGE("Blocks must be removed from sorted list before changing state");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_static)
-    {
-        HEAP_ASSERTMESSAGE("Static blocks may not be added to the pool");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    m_state = State::pool;
-    m_heap = nullptr;
-    m_offset = 0;
-    m_size = 0;
-    m_static = false;
-    m_trackerId = m_invalidTrackerId;
-    m_trackerToken.Clear();
-    m_prev = m_next = nullptr;
-    m_statePrev = m_stateNext = nullptr;
-    m_stateListType = State::stateCount;
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockInternal::Free()
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (m_state == State::deleted)
-    {
-        HEAP_ASSERTMESSAGE("Deleted blocks may not be moved to any state but pool");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_stateListType != State::stateCount)
-    {
-        HEAP_ASSERTMESSAGE("Blocks must be removed from sorted list before changing state");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_static)
-    {
-        HEAP_ASSERTMESSAGE("Static blocks may not be freed");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (m_state != State::pool &&
-        m_state != State::free)
-    {
-        HEAP_CHK_STATUS(m_heap->AdjustFreeSpace(m_size));
-    }
-
-    m_state = State::free;
-    m_trackerId = m_invalidTrackerId;
-    m_trackerToken.Clear();
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockInternal::Allocate(uint32_t trackerId)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (m_state != State::free)
-    {
-        HEAP_ASSERTMESSAGE("Only free blocks may be moved to allocated");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_stateListType != State::stateCount)
-    {
-        HEAP_ASSERTMESSAGE("Blocks must be removed from sorted list before changing state");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (trackerId == m_invalidTrackerId && !m_static)
-    {
-        HEAP_ASSERTMESSAGE("Only static blocks may have invalid tracker IDs");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    // Reflect the change in state from free space to used state.
-    HEAP_CHK_STATUS(m_heap->AdjustUsedSpace(m_size));
-
-    m_state = State::allocated;
-    m_trackerId = trackerId;
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockInternal::Allocate(uint32_t index, uint32_t trackerId, FrameTrackerProducer *producer)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (m_state != State::free)
-    {
-        HEAP_ASSERTMESSAGE("Only free blocks may be moved to allocated");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_stateListType != State::stateCount)
-    {
-        HEAP_ASSERTMESSAGE("Blocks must be removed from sorted list before changing state");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (trackerId == m_invalidTrackerId && !m_static)
-    {
-        HEAP_ASSERTMESSAGE("Only static blocks may have invalid tracker IDs");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    // Reflect the change in state from free space to used state.
-    HEAP_CHK_STATUS(m_heap->AdjustUsedSpace(m_size));
-
-    m_state = State::allocated;
-    if (producer)
-    {
-        m_trackerToken.SetProducer(producer);
-    }
-    m_trackerToken.Merge(index, trackerId);
-
-    return MOS_STATUS_SUCCESS;
-}
-
-
-MOS_STATUS MemoryBlockInternal::Submit()
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (m_state != State::allocated)
-    {
-        HEAP_ASSERTMESSAGE("Only allocated blocks may be submitted");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_static)
-    {
-        HEAP_ASSERTMESSAGE("Static blocks may not enter submitted state");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_stateListType != State::stateCount)
-    {
-        HEAP_ASSERTMESSAGE("Blocks must be removed from sorted list before changing state");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    m_state = State::submitted;
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockInternal::Delete()
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
-
-    if (m_state == State::pool)
-    {
-        HEAP_ASSERTMESSAGE("Pool blocks should not be deleted");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_stateListType != State::stateCount)
-    {
-        HEAP_ASSERTMESSAGE("Blocks must be removed from sorted list before changing state");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_static)
-    {
-        HEAP_ASSERTMESSAGE("Static blocks may not be deleted");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (!m_heap->IsFreeInProgress())
-    {
-        HEAP_ASSERTMESSAGE("Blocks should not be deleted unless the heap is being freed");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (m_state != State::free && m_state != State::deleted)
-    {
-        HEAP_CHK_STATUS(m_heap->AdjustFreeSpace(m_size));
-    }
-
-    m_state = State::deleted;
-    m_trackerId = m_invalidTrackerId;
-    m_trackerToken.Clear();
-
-    return MOS_STATUS_SUCCESS;
-}
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/memory_block.h 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/memory_block.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/memory_block.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/memory_block.h	1970-01-01 00:00:00.000000000 +0000
@@ -1,559 +0,0 @@
-/*
-* Copyright (c) 2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     memory_block.h
-//! \brief    A memory block is a chunk of memory in a heap.
-//! \details  All heap memory is described with memory blocks. Each block has a state
-//!           which determines how it may be used and what other states it may be
-//!           transferred to. The client has limited direct access to a memory block--
-//!           data may be added to the memory location referred to nothing else may be
-//!           modified.
-//!
-
-#ifndef __MEMORY_BLOCK_H__
-#define __MEMORY_BLOCK_H__
-
-#include <memory>
-#include <string>
-#include "heap.h"
-#include "frame_tracker.h"
-
-//! \brief   Describes a block of memory in a heap.
-//! \details For internal use by the MemoryBlockManager only.
-class MemoryBlockInternal
-{
-    friend class MemoryBlockManager;
-
-public:
-    MemoryBlockInternal() { HEAP_FUNCTION_ENTER_VERBOSE; }
-
-    virtual ~MemoryBlockInternal() { HEAP_FUNCTION_ENTER; }
-
-    //!
-    //! \brief  Add data to the memory block.
-    //! \param  [in] data
-    //!         Pointer containint data to insert, must be valid
-    //! \param  [in] dataOffset
-    //!         Relative offset where the data should be inserted within the
-    //!         memory block.
-    //! \param  [in] dataSize
-    //!         Size of the data to be copied from \a data.
-    //! \param  [in] zeroBlock
-    //!         Zeros the entire block, other parameters are not considered
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!       
-    MOS_STATUS AddData(
-        void* data,
-        uint32_t dataOffset,
-        uint32_t dataSize,
-        bool zeroBlock = false);
-
-    //!
-    //! \brief  Read data from the memory block.
-    //! \param  [out] data
-    //!         Pointer to data returned from memory block, must be valid
-    //! \param  [in] dataOffset
-    //!         Relative offset where the data will be read from within the
-    //!         memory block.
-    //! \param  [in] dataSize
-    //!         Size of the data to be copied to \a data.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!       
-    MOS_STATUS ReadData(
-        void* data,
-        uint32_t dataOffset,
-        uint32_t dataSize);
-
-    //!  
-    //! \brief  Dumps the contents of this memory block
-    //! \param  [in] filename
-    //!         The file to be written, includes path
-    //! \param  [in] offset
-    //!         Additional offset to be added to this memory block's offest
-    //! \param  [in] size
-    //!         Size of the data to be dumped, cannot be greater than this memory block's size
-    //! \param  [in] dumpInBinary
-    //!         Dump the data as binary instead of 32-bit hex segments
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!  
-    MOS_STATUS Dump(
-        std::string filename,
-        uint32_t offset = 0,
-        uint32_t size = 0,
-        bool dumpInBinary = false);
-
-    //!
-    //! \brief  Gets the relative offset of the memory block
-    //! \return The relative offset of this block in the heap \see m_offset
-    //!
-    uint32_t GetOffset() { return m_offset; }
-
-    //!
-    //! \brief  Gets the size of the memory block
-    //! \return The size of this block \see m_size
-    //!
-    uint32_t GetSize() { return m_size; }
-
-    //!
-    //! \brief  Gets the tracker ID
-    //! \return This block's tracker ID \see m_trackerId
-    //!
-    uint32_t GetTrackerId() { return m_trackerId; }
-
-    //!
-    //! \brief  Gets the tracker Producer
-    //! \return This block's tracker producer \see m_trackerProducer
-    //!
-    FrameTrackerToken *GetTrackerToken() { return &m_trackerToken; }
-
-    //!
-    //! \brief  Indicates whether or not the memory block is static
-    //! \return If this block is static \see m_static
-    //!
-    bool IsStatic() { return m_static; }
-
-    //! \brief Invalid value to be read from the tracker data \see MemoryBlockInternalManager::m_pTrackerData
-    static const uint32_t m_invalidTrackerId = 0;
-
-protected:
-    //! \brief Possible states of a memory block
-    //! \dot
-    //! digraph states {
-    //!     pool -> free [style = dotted];
-    //!     free -> pool [style = dotted];
-    //!     free -> allocated;
-    //!     free -> deleted;
-    //!     allocated -> submitted;
-    //!     allocated -> deleted;
-    //!     allocated -> allocated [label = "static" labeltooltip = "Static blocks are always in allocated state"];
-    //!     submitted -> allocated [label = "!static" labeltooltip = "This state change requires a refresh."];
-    //!     submitted -> free [label = "!static" labeltooltip = "This state change requires a refresh."];
-    //!     submitted -> deleted;
-    //!     deleted -> pool [style = dotted];
-    //! }
-    //! \enddot
-    enum State
-    {
-        pool = 0,   //!< Memory block is blank and ready to be used by the memory block manager
-        free,       //!< Memory block is available for use by the client
-        allocated,  //!< Space has been acquired in the heap by the client and data may be added to the memory block
-        submitted,  //!< Memory block is submitted, no further changes are permitted
-        deleted,    //!< Memory block is in the process of being freed, may not be used
-        stateCount  //!< Number of states possible for a memory block
-    };
-
-    //!
-    //! \brief  Sets up a memory block in the specified heap
-    //! \param  [in] heap
-    //!         Heap to which this memory block blongs.
-    //! \param  [in] requestedState
-    //!         Requested state for the block.
-    //! \param  [in] prev
-    //!         Memory block which is adjacent to this new block with a lower offset.
-    //! \param  [in] offset
-    //!         Relative offset within \a heap where this memory block is located
-    //! \param  [in] size
-    //!         Size of the memory block.
-    //! \param  [in] trackerId
-    //!         TrackerId associated with this memory block
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS Create(
-        Heap *heap,
-        State requestedState,
-        MemoryBlockInternal *prev,
-        uint32_t offset,
-        uint32_t size,
-        uint32_t trackerId);
-
-    //!
-    //! \brief   Adjusts this block's information such that it may be combined with \a block.
-    //! \details After combining, \a block will be returned to a pool state and this block
-    //!          will have expanded forward or backward to encompass \a block.
-    //! \param   [in] block
-    //!          Must be adjacent to this block to be combined.
-    //! \return  MOS_STATUS
-    //!          MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS Combine(MemoryBlockInternal *block);
-
-    //!
-    //! \brief  Downsizes this block to \a size, puts the remainder into a new block \a block.
-    //! \param  [in,out] block
-    //!         Must be in a pool state. Block which takes some of this blocks space.
-    //! \param  [in] size
-    //!         Size of the new block.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS Split(MemoryBlockInternal *block, uint32_t size);
-
-    //!
-    //! \brief  Indicates that the block is a placeholder until its state changes
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS Pool();
-
-    //!
-    //! \brief  Indicates that the block is ready for re-use
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS Free();
-
-    //!
-    //! \brief  Indicates that the block may be edited
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS Allocate(uint32_t trackerId);
-
-    //!
-    //! \brief  Indicates that the block may be edited
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS Allocate(uint32_t index, uint32_t trackerId, FrameTrackerProducer *producer = nullptr);
-
-    //!
-    //! \brief  Indicates that the client is done editing the memory block.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS Submit();
-
-    //!
-    //! \brief  Indicates that the heap is in the process of being freed.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS Delete();
-
-    //!
-    //! \brief  Indicates the state of the memory block
-    //! \return This block's state \see m_state
-    //!
-    State GetState() { return m_state; }
-
-    //!
-    //! \brief  Forces \see m_static to false
-    //!
-    void ClearStatic() { m_static = false; }
-
-    //!
-    //! \brief  Forces \see m_static to true
-    //!
-    void SetStatic() { m_static = true; }
-
-    //!
-    //! \brief  Gets the previous memory block
-    //! \return The previous adjacent block \see m_prev
-    //!
-    MemoryBlockInternal *GetPrev() { return m_prev; }
-
-    //!
-    //! \brief  Gets the next memory block
-    //! \return The next adjacent block \see m_next
-    //!
-    MemoryBlockInternal *GetNext() { return m_next; }
-
-    //!
-    //! \brief  Gets the heap of the memory block
-    //! \return The heap that this block belongs to \see m_heap
-    //!
-    Heap *GetHeap()
-    {
-        if (m_heap != nullptr)
-        {
-            if (!m_heap->IsValid())
-            {
-                HEAP_ASSERTMESSAGE("Memory block does not have a valid heap to return");
-                return nullptr;
-            }
-        }
-        return m_heap;
-    }
-
-private:
-    //! \brief The heap referred to by the memory block
-    Heap *m_heap = nullptr;
-    //! \brief The relative offset of the memory block within the heap.
-    uint32_t m_offset = 0;
-    //! \brief Size of the memory block.
-    uint32_t m_size = 0;
-    //! \brief State of this memory block
-    State m_state = State::pool;
-    //! \brief   Static memory blocks are controlled by the client and may not be auto-freed
-    //! \details Since the client controls static blocks, static blocks are allowed to have
-    //!          invalid tracker IDs.
-    bool m_static = false;
-    //! \brief Software tag used to determine whether or not a memory block is still in use.
-    uint32_t m_trackerId = m_invalidTrackerId;
-    //! \brief Multiple software tags used to determine whether or not a memory block is still in use.
-    FrameTrackerToken m_trackerToken;
-
-    //! \brief   The previous block in memory, this block is adjacent in heap memory.
-    //! \details Due to the way that the memory manager handles heap memory block lists--by having
-    //!          a dummy block at the start of a heaps block list, this pointer is always expected to
-    //!          be valid for non-pool state blocks.
-    MemoryBlockInternal *m_prev = nullptr;
-    //! \brief   The next block in memory, this block is adjacent in heap memory.
-    //! \details If this block is at the end of the heap, the next block is expected to be nullptr.
-    MemoryBlockInternal *m_next = nullptr;
-
-    //! \brief Previous sorted block, nullptr if this block is the first in the sorted list
-    MemoryBlockInternal *m_statePrev = nullptr;
-    //! \brief Next block in sorted list, nullptr if this block is last in the sorted list
-    MemoryBlockInternal *m_stateNext = nullptr;
-    //! \brief State type for the sorted list to which this block belongs, if between lists type is stateCount
-    State m_stateListType = State::stateCount;
-};
-
-//! \brief Describes a block of memory in a heap.
-class MemoryBlock
-{
-    friend class MemoryBlockManager;
-
-public:
-    MemoryBlock()
-    {
-        HEAP_FUNCTION_ENTER_VERBOSE;
-        m_resource = nullptr;
-    }
-
-    virtual ~MemoryBlock() { HEAP_FUNCTION_ENTER_VERBOSE; }
-
-    //!
-    //! \brief  Add data to the memory block.
-    //! \param  [in] data
-    //!         Pointer containint data to insert, must be valid
-    //! \param  [in] dataOffset
-    //!         Relative offset where the data should be inserted within the
-    //!         memory block.
-    //! \param  [in] dataSize
-    //!         Size of the data to be copied from \a data.
-    //! \param  [in] zeroBlock
-    //!         Zeros the entire block, other parameters are not considered
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!       
-    MOS_STATUS AddData(
-        void* data,
-        uint32_t dataOffset,
-        uint32_t dataSize,
-        bool zeroBlock = false)
-    {
-        if (!m_valid || m_block == nullptr)
-        {
-            HEAP_ASSERTMESSAGE("The memory block is not valid!");
-            return MOS_STATUS_INVALID_PARAMETER;
-        }
-        return m_block->AddData(data, dataOffset, dataSize, zeroBlock);
-    }
-
-    //!
-    //! \brief  Read data from the memory block.
-    //! \param  [out] data
-    //!         Pointer to data returned from memory block, must be valid
-    //! \param  [in] dataOffset
-    //!         Relative offset where the data will be read from within the
-    //!         memory block.
-    //! \param  [in] dataSize
-    //!         Size of the data to be copied to \a data.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!       
-    MOS_STATUS ReadData(
-        void* data,
-        uint32_t dataOffset,
-        uint32_t dataSize)
-    {
-        if (!m_valid || m_block == nullptr)
-        {
-            HEAP_ASSERTMESSAGE("The memory block is not valid!");
-            return MOS_STATUS_INVALID_PARAMETER;
-        }
-
-        return m_block->ReadData(data, dataOffset, dataSize);
-    }
-
-    //!  
-    //! \brief  Dumps the contents of this memory block
-    //! \param  [in] filename
-    //!         The file to be written, includes path
-    //! \param  [in] offset
-    //!         Additional offset to be added to this memory block's offest
-    //! \param  [in] size
-    //!         Size of the data to be dumped, cannot be greater than this memory block's size
-    //! \param  [in] dumpInBinary
-    //!         Dump the data as binary instead of 32-bit hex segments
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!  
-    MOS_STATUS Dump(
-        std::string filename,
-        uint32_t offset = 0,
-        uint32_t size = 0,
-        bool dumpInBinary = false)
-    {
-        if (!m_valid || m_block == nullptr)
-        {
-            HEAP_ASSERTMESSAGE("The memory block is not valid!");
-            return MOS_STATUS_INVALID_PARAMETER;
-        }
-        return m_block->Dump(filename, offset, size, dumpInBinary);
-    }
-
-    //!
-    //! \brief  Indicates whether or not the memory block is static
-    //! \return If this block is static \see m_static
-    //!
-    bool IsValid() { return m_valid; }
-
-    //!
-    //! \brief  Gets the relative offset of the memory block
-    //! \return The relative offset of this block in the heap \see m_offset
-    //!
-    uint32_t GetOffset() { return m_offset; }
-
-    //!
-    //! \brief  Gets the size of the memory block
-    //! \return The size of this block \see m_size
-    //!
-    uint32_t GetSize() { return m_size; }
-
-    //!
-    //! \brief  Gets the tracker ID
-    //! \return This block's tracker ID \see m_trackerId
-    //!
-    uint32_t GetTrackerId() { return m_trackerId; }
-
-    //!
-    //! \brief  Indicates whether or not the memory block is static
-    //! \return If this block is static \see m_static
-    //!
-    bool IsStatic() { return m_static; }
-
-    //!
-    //! \brief  Gets the heap of the memory block
-    //! \return The heap that this block belongs to \see m_heap
-    //!
-    MOS_RESOURCE* GetResource()
-    {
-        HEAP_FUNCTION_ENTER_VERBOSE;
-        if (!m_valid)
-        {
-            HEAP_ASSERTMESSAGE("The memory block is not valid!");
-            return nullptr;
-        }
-        if (Mos_ResourceIsNull(m_resource))
-        {
-            HEAP_ASSERTMESSAGE("The heap resource is invalid");
-            return nullptr;
-        }
-        return m_resource;
-    }
-
-    //!
-    //! \brief  Gets the size of the heap to which the memory block belongs
-    //! \return The size of the associated heap \see m_heapSize
-    //!
-    uint32_t GetHeapSize() { return m_heapSize; }
-
-#if (_DEBUG || _RELEASE_INTERNAL)
-    //!
-    //! \brief   Gets the locked heap
-    //! \details To be used when the memory block dump is insufficient.
-    //! \return  Pointer to the locked heap data \see m_lockedHeap
-    //!
-    uint8_t* GetHeapLockedData() { return m_lockedHeap; }
-#endif
-
-    //! \brief Invalid value to be read from the tracker data \see MemoryBlockInternalManager::m_pTrackerData
-    static const uint32_t m_invalidTrackerId = MemoryBlockInternal::m_invalidTrackerId;
-
-protected:
-    //!
-    //! \brief  Initializes memory block based on provided inputs
-    //! \param  [in] internalBlock
-    //!         Internal block used to initialize this memory block
-    //! \param  [in] heap
-    //!         Heap used to initialize this memory block
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS CreateFromInternalBlock(
-        MemoryBlockInternal *internalBlock,
-        Heap *heap,
-        uint8_t *lockedHeap)
-    {
-        HEAP_CHK_NULL(internalBlock);
-        HEAP_CHK_NULL(heap);
-        if (!heap->IsValid())
-        {
-            HEAP_ASSERTMESSAGE("Memory block does not have a valid heap to return");
-            return MOS_STATUS_INVALID_PARAMETER;
-        }
-        HEAP_CHK_NULL(m_resource = heap->GetResource());
-        m_heapSize = heap->GetSize();
-#if (_DEBUG || _RELEASE_INTERNAL)
-        m_lockedHeap = lockedHeap;
-#endif
-        m_offset = internalBlock->GetOffset();
-        m_size = internalBlock->GetSize();
-        m_static = internalBlock->IsStatic();
-        m_trackerId = internalBlock->GetTrackerId();
-        m_block = internalBlock;
-        m_valid = true;
-        return MOS_STATUS_SUCCESS;
-    }
-
-    //!
-    //! \brief  Gets the internal memory block
-    //! \return The internal memory block backing up this data
-    //!
-    MemoryBlockInternal *GetInternalBlock() { return m_block; }
-
-private:
-    bool m_valid = false;       //!< Memory block is valid.
-    MOS_RESOURCE *m_resource;    //!< Graphics resource for the heap
-#if (_DEBUG || _RELEASE_INTERNAL)
-    uint8_t *m_lockedHeap = nullptr;    //!< Pointer to the locked heap data, only valid if kept locked
-#endif
-    uint32_t m_heapSize = 0;    //!< Size of the heap
-    uint32_t m_offset = 0;      //!< relative offset of the memory block within the heap.
-    uint32_t m_size = 0;        //!< Size of the memory block.
-    //! \brief   Static memory blocks are controlled by the client and may not be auto-freed
-    //! \details Since the client controls static blocks, static blocks are allowed to have
-    //!          invalid tracker IDs.
-    bool m_static = false;
-    //! \brief Software tag used to determine whether or not a memory block is still in use.
-    uint32_t m_trackerId = m_invalidTrackerId;
-    MemoryBlockInternal *m_block = nullptr; //!< Reference to the internal memory block
-};
-
-#endif // __MEMORY_BLOCK_H__
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/memory_block_manager.cpp 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/memory_block_manager.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/memory_block_manager.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/memory_block_manager.cpp	1970-01-01 00:00:00.000000000 +0000
@@ -1,845 +0,0 @@
-/*
-* Copyright (c) 2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     memory_block_manager.cpp
-//! \brief    Implements functionalities pertaining to the memory block manager
-//!
-
-#include "memory_block_manager.h"
-
-MemoryBlockManager::~MemoryBlockManager()
-{
-    HEAP_FUNCTION_ENTER;
-    m_heaps.clear();
-    m_deletedHeaps.clear();
-    HEAP_VERBOSEMESSAGE("Total heap size is %d", m_totalSizeOfHeaps);
-    for (uint8_t i = 0; i < MemoryBlockInternal::State::stateCount; i++)
-    {
-        HEAP_VERBOSEMESSAGE("%d blocks in pool %d with size %d", m_sortedBlockListNumEntries[i], i, m_sortedBlockListSizes[i]);
-
-        // pool blocks are not part of the adjacency list and must be freed separately
-        if (i == MemoryBlockInternal::State::pool)
-        {
-            auto curr = m_sortedBlockList[i];
-            MemoryBlockInternal *next = nullptr;
-            while (curr != nullptr)
-            {
-                next = curr->m_stateNext;
-                MOS_Delete(curr);
-                curr = next;
-            }
-        }
-    }
-}
-
-MOS_STATUS MemoryBlockManager::AcquireSpace(
-    AcquireParams &params,
-    std::vector<MemoryBlock> &blocks,
-    uint32_t &spaceNeeded)
-{
-    HEAP_FUNCTION_ENTER;
-
-    if (params.m_blockSizes.empty())
-    {
-        HEAP_ASSERTMESSAGE("No space is being requested");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (m_sortedSizes.size() != params.m_blockSizes.size())
-    {
-        m_sortedSizes.resize(params.m_blockSizes.size());
-    }
-    uint32_t alignment = MOS_MAX(m_blockAlignment, MOS_ALIGN_CEIL(params.m_alignment, m_blockAlignment));
-    uint32_t idx = 0;
-    auto sortedIterator = m_sortedSizes.begin();
-    for (auto requestIterator = params.m_blockSizes.begin();
-        requestIterator != params.m_blockSizes.end();
-        ++requestIterator)
-    {
-        if (sortedIterator == m_sortedSizes.end())
-        {
-            HEAP_ASSERTMESSAGE("sortedSizes is expected to be the same size as the number of blocks requested");
-            return MOS_STATUS_UNKNOWN;
-        }
-        (*sortedIterator).m_originalIdx = idx++;
-        (*sortedIterator).m_blockSize = MOS_ALIGN_CEIL(*requestIterator, alignment);
-        ++sortedIterator;
-    }
-    if (m_sortedSizes.size() > 1)
-    {
-        m_sortedSizes.sort([](SortedSizePair &a, SortedSizePair &b) { return a.m_blockSize > b.m_blockSize; });
-    }
-
-    if (m_sortedBlockListNumEntries[MemoryBlockInternal::submitted] > m_numSubmissionsForRefresh)
-    {
-        bool blocksUpdated = false;
-        HEAP_CHK_STATUS(RefreshBlockStates(blocksUpdated));
-    }
-
-    spaceNeeded = 0;
-    HEAP_CHK_STATUS(IsSpaceAvailable(params, spaceNeeded));
-    if (spaceNeeded == 0)
-    {
-        HEAP_CHK_STATUS(AllocateSpace(params, blocks));
-        return MOS_STATUS_SUCCESS;
-    }
-
-    blocks.clear();
-    return MOS_STATUS_CLIENT_AR_NO_SPACE;
-}
-
-MOS_STATUS MemoryBlockManager::SubmitBlocks(std::vector<MemoryBlock> &blocks)
-{
-    HEAP_FUNCTION_ENTER;
-
-    if (blocks.empty())
-    {
-        HEAP_ASSERTMESSAGE("No blocks to submit");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    for (uint32_t i = 0; i < blocks.size(); ++i)
-    {
-        if (!blocks[i].IsValid())
-        {
-            HEAP_ASSERTMESSAGE("Block %d is not valid and may not be submitted", i);
-            return MOS_STATUS_INVALID_PARAMETER;
-        }
-
-        auto internalBlock = blocks[i].GetInternalBlock();
-        HEAP_CHK_NULL(internalBlock);
-        HEAP_CHK_STATUS(RemoveBlockFromSortedList(internalBlock, internalBlock->GetState()));
-        HEAP_CHK_STATUS(internalBlock->Submit());
-        HEAP_CHK_STATUS(AddBlockToSortedList(internalBlock, internalBlock->GetState()));
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::ClearSpace(MemoryBlock &block)
-{
-    HEAP_FUNCTION_ENTER;
-
-    if (!block.IsValid())
-    {
-        HEAP_ASSERTMESSAGE("Block is not valid and may not be cleared");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    auto internalBlock = block.GetInternalBlock();
-    HEAP_CHK_NULL(internalBlock);
-    internalBlock->ClearStatic();
-    bool blocksUpdated = false;
-    HEAP_CHK_STATUS(RefreshBlockStates(blocksUpdated));
-    // Reset memory block to blank state to return to client
-    block = MemoryBlock();
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::RefreshBlockStates(bool &blocksUpdated)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if ((!m_useProducer && m_trackerData == nullptr) 
-        || (m_useProducer && m_trackerProducer == nullptr))
-    {
-        HEAP_ASSERTMESSAGE("It is not possible to check current tracker ID");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    blocksUpdated = false;
-    uint32_t currTrackerId = 0;
-    if (!m_useProducer)
-    {
-        currTrackerId = *m_trackerData;
-    }
-
-    auto block = m_sortedBlockList[MemoryBlockInternal::State::submitted];
-    MemoryBlockInternal *nextSubmitted = nullptr;
-    while (block != nullptr)
-    {
-        nextSubmitted = block->m_stateNext;
-        FrameTrackerToken *trackerToken = block->GetTrackerToken();
-        if ( (!m_useProducer && block->GetTrackerId() <= currTrackerId)
-            ||(m_useProducer && trackerToken->IsExpired()))
-        {
-            auto heap = block->GetHeap();
-            HEAP_CHK_NULL(heap);
-
-            if (heap->IsFreeInProgress())
-            {
-                // Add the block to deleted list instead of freed to prevent it from being reused
-                HEAP_CHK_STATUS(RemoveBlockFromSortedList(block, block->GetState()));
-                HEAP_CHK_STATUS(block->Delete());
-                HEAP_CHK_STATUS(AddBlockToSortedList(block, block->GetState()));
-                block = nextSubmitted;
-                continue;
-            }
-
-            HEAP_CHK_STATUS(RemoveBlockFromSortedList(block, block->GetState()));
-            HEAP_CHK_STATUS(block->Free());
-            HEAP_CHK_STATUS(AddBlockToSortedList(block, block->GetState()));
-
-            // Consolidate free blocks
-            auto prev = block->GetPrev(), next = block->GetNext();
-            if (prev && prev->GetState() == MemoryBlockInternal::State::free)
-            {
-                HEAP_CHK_STATUS(MergeBlocks(prev, block));
-                // re-assign block to pPrev for use in MergeBlocks with pNext
-                block = prev;
-            }
-            else if (prev == nullptr)
-            {
-                HEAP_ASSERTMESSAGE("The previous block should always be valid");
-                return MOS_STATUS_UNKNOWN;
-            }
-
-            if (next && next->GetState() == MemoryBlockInternal::State::free)
-            {
-                HEAP_CHK_STATUS(MergeBlocks(block, next));
-            }
-
-            blocksUpdated = true;
-        }
-        block = nextSubmitted;
-    }
-
-    if (blocksUpdated && !m_deletedHeaps.empty())
-    {
-        HEAP_CHK_STATUS(CompleteHeapDeletion());
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::RegisterHeap(uint32_t heapId, uint32_t size , bool hwWriteOnly)
-{
-    HEAP_FUNCTION_ENTER;
-
-    MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
-
-    auto heap = MOS_New(Heap, heapId);
-    HEAP_CHK_NULL(heap);
-    HEAP_CHK_STATUS(heap->RegisterOsInterface(m_osInterface));
-    size = MOS_ALIGN_CEIL(size, m_heapAlignment);
-    
-    if (hwWriteOnly)
-    {
-        heap->SetHeapHwWriteOnly(hwWriteOnly);
-    }
-
-    HEAP_CHK_STATUS(heap->Allocate(size, m_lockHeapsOnAllocate));
-
-    if (heap->IsValid())
-    {
-        MemoryBlockInternal *adjacencyListBegin = nullptr;
-        adjacencyListBegin = MOS_New(MemoryBlockInternal);
-        HEAP_CHK_NULL(adjacencyListBegin);
-        auto block = GetBlockFromPool();
-        HEAP_CHK_NULL(block);
-
-        std::shared_ptr<HeapWithAdjacencyBlockList> managedHeap = nullptr;
-        managedHeap = MakeShared<HeapWithAdjacencyBlockList>();
-        HEAP_CHK_NULL(managedHeap);
-        managedHeap->m_heap = heap;
-        managedHeap->m_size = managedHeap->m_heap->GetSize();
-        managedHeap->m_adjacencyListBegin = adjacencyListBegin;
-        m_totalSizeOfHeaps += managedHeap->m_size;
-        m_heaps.push_back(std::move(managedHeap));
-
-        HEAP_CHK_STATUS(block->Create(
-            heap,
-            MemoryBlockInternal::State::free,
-            adjacencyListBegin,
-            0,
-            size,
-            MemoryBlockInternal::m_invalidTrackerId));
-        HEAP_CHK_STATUS(AddBlockToSortedList(block, block->GetState()));
-    }
-    else
-    {
-        HEAP_ASSERTMESSAGE("Cannot register invalid heap");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    return eStatus;
-}
-
-MOS_STATUS MemoryBlockManager::UnregisterHeap(uint32_t heapId)
-{
-    HEAP_FUNCTION_ENTER;
-
-    for (auto iterator = m_heaps.begin(); iterator != m_heaps.end(); ++iterator)
-    {
-        if (heapId == (*iterator)->m_heap->GetId())
-        {
-            bool blocksUpdated = false;
-            RefreshBlockStates(blocksUpdated);
-            (*iterator)->m_heap->PrepareForFree();
-            m_totalSizeOfHeaps -= (*iterator)->m_heap->GetSize();
-
-            // free blocks may be removed right away
-            auto block = m_sortedBlockList[MemoryBlockInternal::State::free];
-            MemoryBlockInternal *next = nullptr;
-            while (block != nullptr)
-            {
-                next = block->m_stateNext;
-                auto heap = block->GetHeap();
-                if (heap != nullptr)
-                {
-                    if (heap->GetId() == heapId)
-                    {
-                        HEAP_CHK_STATUS(RemoveBlockFromSortedList(block, block->GetState()));
-                        HEAP_CHK_STATUS(block->Delete());
-                        HEAP_CHK_STATUS(AddBlockToSortedList(block, block->GetState()));
-                    }
-                }
-                else
-                {
-                    HEAP_ASSERTMESSAGE("A block with an invlid heap is in the free list!");
-                    return MOS_STATUS_UNKNOWN;
-                }
-                block = next;
-            }
-
-            m_deletedHeaps.push_back((*iterator));
-            m_heaps.erase(iterator);
-            HEAP_CHK_STATUS(CompleteHeapDeletion());
-            return MOS_STATUS_SUCCESS;
-        }
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::CompleteHeapDeletion()
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    auto iterator = m_deletedHeaps.begin();
-    while (iterator != m_deletedHeaps.end())
-    {
-        // if the heap is still not empty, continue with the loop
-        if ((*iterator)->m_heap->GetUsedSize() == 0)
-        {
-            uint32_t heapId = (*iterator)->m_heap->GetId();
-            HEAP_CHK_STATUS(RemoveHeapFromSortedBlockList(heapId));
-            iterator = m_deletedHeaps.erase(iterator);
-        }
-        else
-        {
-            ++iterator;
-        }
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::RegisterTrackerResource(uint32_t *trackerData)
-{
-    HEAP_FUNCTION_ENTER;
-    HEAP_CHK_NULL(trackerData);
-    m_trackerData = trackerData;
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::RegisterTrackerProducer(FrameTrackerProducer *trackerProducer)
-{
-    HEAP_FUNCTION_ENTER;
-    HEAP_CHK_NULL(trackerProducer);
-    m_trackerProducer = trackerProducer;
-    m_useProducer = true;
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::RegisterOsInterface(PMOS_INTERFACE osInterface)
-{
-    HEAP_FUNCTION_ENTER;
-    HEAP_CHK_NULL(osInterface);
-    m_osInterface = osInterface;
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::IsSpaceAvailable(
-    AcquireParams &params,
-    uint32_t &spaceNeeded)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (m_sortedSizes.empty())
-    {
-        HEAP_ASSERTMESSAGE("No space is being requested");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-    if (m_sortedBlockList[MemoryBlockInternal::State::free] == nullptr)
-    {
-        bool blocksUpdated = false;
-        HEAP_CHK_STATUS(RefreshBlockStates(blocksUpdated));
-        if (!blocksUpdated)
-        {
-            HEAP_NORMALMESSAGE("All heap space is in use by active workloads.");
-        }
-    }
-
-    auto block = m_sortedBlockList[MemoryBlockInternal::State::free];
- 
-    for (auto requestIterator = m_sortedSizes.begin();
-        requestIterator != m_sortedSizes.end();
-        ++requestIterator)
-    {
-        if (block == nullptr)
-        {
-            // There is no free space available, add up all requested sizes
-            spaceNeeded += (*requestIterator).m_blockSize;
-        }
-        else
-        {
-            // Determine whether or not there is space available
-            if ((*requestIterator).m_blockSize > block->GetSize())
-            {
-                // The requested size is larger than the largest free block size
-                spaceNeeded += (*requestIterator).m_blockSize;
-                continue;
-            }
-            else
-            {
-                // determine if there is enough space in the heaps
-                auto freeBlockSize = block->GetSize();
-                while (requestIterator != m_sortedSizes.end())
-                {
-                    if ((*requestIterator).m_blockSize < freeBlockSize)
-                    {
-                        // if the aligned size fits within the current free block, consider it used
-                        freeBlockSize -= (*requestIterator).m_blockSize;
-                        ++requestIterator;
-                    }
-                    else
-                    {
-                        // if the aligned size does not fit within the curret free block, continue for loop
-                        break;
-                    }
-                }
-                if (requestIterator == m_sortedSizes.end())
-                {
-                    break;
-                }
-            }
-        }
-        if (block != nullptr)
-        {
-            block = block->m_stateNext;
-        }
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::AllocateSpace(
-    AcquireParams &params,
-    std::vector<MemoryBlock> &blocks)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    if (m_sortedSizes.empty())
-    {
-        HEAP_ASSERTMESSAGE("No space is being requested");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (m_sortedBlockList[MemoryBlockInternal::State::free] == nullptr)
-    {
-        HEAP_ASSERTMESSAGE("No free blocks available");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (blocks.size() != m_sortedSizes.size())
-    {
-        blocks.resize(m_sortedSizes.size());
-    }
-
-    for (auto requestIterator = m_sortedSizes.begin();
-        requestIterator != m_sortedSizes.end();
-        ++requestIterator)
-    {
-        bool allocated = false;
-        auto block = m_sortedBlockList[MemoryBlockInternal::State::free];
-        while (block != nullptr)
-        {
-            if (block->GetSize() >= (*requestIterator).m_blockSize)
-            {
-                auto heap = block->GetHeap();
-                HEAP_CHK_NULL(heap);
-                if (!m_useProducer)
-                {
-                    HEAP_CHK_STATUS(AllocateBlock(
-                        (*requestIterator).m_blockSize,
-                        params.m_trackerId,
-                        params.m_staticBlock,
-                        block));
-                }
-                else
-                {
-                    HEAP_CHK_STATUS(AllocateBlock(
-                        (*requestIterator).m_blockSize,
-                        params.m_trackerIndex,
-                        params.m_trackerId,
-                        params.m_staticBlock,
-                        block));
-                }
-                if ((*requestIterator).m_originalIdx >= m_sortedSizes.size())
-                {
-                    HEAP_ASSERTMESSAGE("Index is out of bounds");
-                    return MOS_STATUS_INVALID_PARAMETER;
-                }
-                HEAP_CHK_STATUS(blocks[(*requestIterator).m_originalIdx].CreateFromInternalBlock(
-                    block,
-                    heap,
-                    heap->m_keepLocked ? heap->m_lockedHeap : nullptr));
-                allocated = true;
-                break;
-            }
-            block = block->m_stateNext;
-        }
-
-        if (!allocated)
-        {
-            HEAP_ASSERTMESSAGE("No free block was found for the data! This should not occur.");
-            return MOS_STATUS_UNKNOWN;
-        }
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::AllocateBlock(
-    uint32_t alignedSize,
-    uint32_t trackerId,
-    bool staticBlock,
-    MemoryBlockInternal *freeBlock)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    HEAP_CHK_NULL(freeBlock);
-
-    if (alignedSize == 0 || alignedSize > freeBlock->GetSize())
-    {
-        HEAP_ASSERTMESSAGE("Size requested is invalid");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (freeBlock->GetState() != MemoryBlockInternal::State::free)
-    {
-        HEAP_ASSERTMESSAGE("Free block is not free");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    HEAP_CHK_STATUS(RemoveBlockFromSortedList(freeBlock, freeBlock->GetState()));
-
-    if (alignedSize < freeBlock->GetSize())
-    {
-        auto remainderBlock = GetBlockFromPool();
-        HEAP_CHK_NULL(remainderBlock);
-        freeBlock->Split(remainderBlock, alignedSize);
-        HEAP_CHK_STATUS(AddBlockToSortedList(remainderBlock, remainderBlock->GetState()));
-    }
-    if (staticBlock)
-    {
-        freeBlock->SetStatic();
-    }
-    HEAP_CHK_STATUS(freeBlock->Allocate(trackerId));
-    HEAP_CHK_STATUS(AddBlockToSortedList(freeBlock, freeBlock->GetState()));
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::AllocateBlock(
-    uint32_t alignedSize,
-    uint32_t index,
-    uint32_t trackerId,
-    bool staticBlock,
-    MemoryBlockInternal *freeBlock)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    HEAP_CHK_NULL(freeBlock);
-
-    if (!m_useProducer)
-    {
-        HEAP_ASSERTMESSAGE("FrameTrackerProducer need to be registered");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (alignedSize == 0 || alignedSize > freeBlock->GetSize())
-    {
-        HEAP_ASSERTMESSAGE("Size requested is invalid");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (freeBlock->GetState() != MemoryBlockInternal::State::free)
-    {
-        HEAP_ASSERTMESSAGE("Free block is not free");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    HEAP_CHK_STATUS(RemoveBlockFromSortedList(freeBlock, freeBlock->GetState()));
-
-    if (alignedSize < freeBlock->GetSize())
-    {
-        auto remainderBlock = GetBlockFromPool();
-        HEAP_CHK_NULL(remainderBlock);
-        freeBlock->Split(remainderBlock, alignedSize);
-        HEAP_CHK_STATUS(AddBlockToSortedList(remainderBlock, remainderBlock->GetState()));
-    }
-    if (staticBlock)
-    {
-        freeBlock->SetStatic();
-    }
-    HEAP_CHK_STATUS(freeBlock->Allocate(index, trackerId, m_trackerProducer));
-    HEAP_CHK_STATUS(AddBlockToSortedList(freeBlock, freeBlock->GetState()));
-
-    return MOS_STATUS_SUCCESS;
-}
-
-
-MOS_STATUS MemoryBlockManager::AddBlockToSortedList(
-    MemoryBlockInternal *block,
-    MemoryBlockInternal::State state)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    HEAP_CHK_NULL(block);
-
-    if (block->m_statePrev || block->m_stateNext)
-    {
-        HEAP_ASSERTMESSAGE("Inserted blocks should not be in a state list already");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    if (state != block->GetState() ||
-        block->m_stateListType != MemoryBlockInternal::State::stateCount)
-    {
-        HEAP_ASSERTMESSAGE("State does not match list to be added to");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    auto curr = m_sortedBlockList[state];
-
-    switch (state)
-    {
-        case MemoryBlockInternal::State::free:
-        {
-            bool inserted = false;
-            MemoryBlockInternal *prev = nullptr;
-            while (curr != nullptr)
-            {
-                if (curr->GetSize() <= block->GetSize())
-                {
-                    if (prev)
-                    {
-                        prev->m_stateNext = block;
-                    }
-                    else
-                    {
-                        m_sortedBlockList[state] = block;
-                    }
-                    curr->m_statePrev = block;
-                    block->m_statePrev = prev;
-                    block->m_stateNext = curr;
-                    inserted = true;
-                    break;
-                }
-                prev = curr;
-                curr = curr->m_stateNext;
-            }
-            if (!inserted)
-            {
-                if (prev == nullptr)
-                {
-                    block->m_stateNext = m_sortedBlockList[state];
-                    m_sortedBlockList[state] = block;
-                }
-                else
-                {
-                    block->m_statePrev = prev;
-                    prev->m_stateNext = block;
-                }
-            }
-            block->m_stateListType = state;
-            m_sortedBlockListNumEntries[state]++;
-            m_sortedBlockListSizes[state] += block->GetSize();
-            break;
-        }
-        case MemoryBlockInternal::State::allocated:
-        case MemoryBlockInternal::State::submitted:
-        case MemoryBlockInternal::State::deleted:
-            block->m_stateNext = curr;
-            if (curr)
-            {
-                curr->m_statePrev = block;
-            }
-            m_sortedBlockList[state] = block;
-            block->m_stateListType = state;
-            m_sortedBlockListNumEntries[state]++;
-            m_sortedBlockListSizes[state] += block->GetSize();
-            break;
-        case MemoryBlockInternal::State::pool: 
-            block->m_stateNext = curr;
-            if (curr)
-            {
-                curr->m_statePrev = block;
-            }
-            block->m_stateListType = state;
-            m_sortedBlockList[state] = block;
-            m_sortedBlockListNumEntries[state]++;
-            break;
-        default:
-            HEAP_ASSERTMESSAGE("This state type is unsupported");
-            return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::RemoveBlockFromSortedList(
-    MemoryBlockInternal *block,
-    MemoryBlockInternal::State state)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    HEAP_CHK_NULL(block);
-
-    switch (state)
-    {
-        case MemoryBlockInternal::State::free:
-        case MemoryBlockInternal::State::allocated:
-        case MemoryBlockInternal::State::submitted:
-        case MemoryBlockInternal::State::deleted:
-        {
-            if (block->m_statePrev)
-            {
-                block->m_statePrev->m_stateNext = block->m_stateNext;
-            }
-            else
-            {
-                // special case for beginning of list
-                m_sortedBlockList[state] = block->m_stateNext;
-            }
-            if (block->m_stateNext)
-            {
-                block->m_stateNext->m_statePrev = block->m_statePrev;
-            }
-            block->m_statePrev = block->m_stateNext = nullptr;
-            block->m_stateListType = MemoryBlockInternal::State::stateCount;
-            m_sortedBlockListNumEntries[state]--;
-            m_sortedBlockListSizes[state] -= block->GetSize();
-            break;
-        }
-        default:
-            HEAP_ASSERTMESSAGE("This state type is unsupported");
-            return MOS_STATUS_INVALID_PARAMETER;
-            break;
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MemoryBlockInternal *MemoryBlockManager::GetBlockFromPool()
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    MemoryBlockInternal *block = nullptr;
-
-    if (m_sortedBlockList[MemoryBlockInternal::State::pool] == nullptr)
-    {
-        block = MOS_New(MemoryBlockInternal);
-    }
-    else
-    {
-        block = m_sortedBlockList[MemoryBlockInternal::State::pool];
-        if (block->m_stateNext)
-        {
-            block->m_stateNext->m_statePrev = nullptr;
-        }
-        // refresh beginning of list
-        m_sortedBlockList[MemoryBlockInternal::State::pool] = block->m_stateNext;
-        block->m_statePrev = block->m_stateNext = nullptr;
-        block->m_stateListType = MemoryBlockInternal::State::stateCount;
-        m_sortedBlockListNumEntries[MemoryBlockInternal::State::pool]--;
-    }
-
-    return block;
-}
-
-MOS_STATUS MemoryBlockManager::RemoveHeapFromSortedBlockList(uint32_t heapId)
-{
-    for (auto state = 0; state < MemoryBlockInternal::State::stateCount; ++state)
-    {
-        if (state == MemoryBlockInternal::State::pool)
-        {
-            continue;
-        }
-
-        auto curr = m_sortedBlockList[state];
-        Heap *heap = nullptr;
-        MemoryBlockInternal *nextBlock = nullptr;
-        while (curr != nullptr)
-        {
-            nextBlock = curr->m_stateNext;
-            heap = curr->GetHeap();
-            HEAP_CHK_NULL(heap);
-            if (heap->GetId() == heapId)
-            {
-                HEAP_CHK_STATUS(RemoveBlockFromSortedList(curr, curr->GetState()));
-            }
-            curr = nextBlock;
-        }
-    }
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MemoryBlockManager::MergeBlocks(
-    MemoryBlockInternal *blockCombined,
-    MemoryBlockInternal *blockRelease)
-{
-    HEAP_FUNCTION_ENTER_VERBOSE;
-
-    HEAP_CHK_NULL(blockCombined);
-    HEAP_CHK_NULL(blockRelease);
-
-    if (blockCombined->GetState() != MemoryBlockInternal::State::free ||
-        blockRelease->GetState() != MemoryBlockInternal::State::free)
-    {
-        HEAP_ASSERTMESSAGE("Only free blocks may be merged");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    HEAP_CHK_STATUS(RemoveBlockFromSortedList(blockCombined, blockCombined->GetState()));
-    HEAP_CHK_STATUS(RemoveBlockFromSortedList(blockRelease, blockRelease->GetState()));
-    HEAP_CHK_STATUS(blockCombined->Combine(blockRelease));
-    HEAP_CHK_STATUS(AddBlockToSortedList(blockRelease, blockRelease->GetState()));
-    HEAP_CHK_STATUS(AddBlockToSortedList(blockCombined, blockCombined->GetState()));
-
-    return MOS_STATUS_SUCCESS;
-}
-
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/memory_block_manager.h 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/memory_block_manager.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/heap_manager/memory_block_manager.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/heap_manager/memory_block_manager.h	1970-01-01 00:00:00.000000000 +0000
@@ -1,449 +0,0 @@
-/*
-* Copyright (c) 2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     memory_block_manager.h
-//! \brief    Manages the memory blocks belonging to all heaps.
-//! \details  Ensures that all memory is accounted for per heap for each block.
-//!           Determines when blocks are no longer being processed and automatically
-//!           reclaims free space in the state heap. Manages the state transitions of
-//!           the memory blocks. The client has not direct access to the memory block
-//!           manager.
-//!
-
-#ifndef __MEMORY_BLOCK_MANAGER_H__
-#define __MEMORY_BLOCK_MANAGER_H__
-
-#include <list>
-#include <vector>
-#include <memory>
-#include "heap.h"
-#include "memory_block.h"
-
-class FrameTrackerProducer;
-
-//! \brief Used by the heap manager to allow the client to access the heap memory.
-class MemoryBlockManager
-{
-    friend class HeapManager;
-
-public:
-    //! \brief Used by the client to acquire space in heap memory.
-    class AcquireParams
-    {
-    public:
-        //! \brief initializes AcquireParams with a tracker ID
-        AcquireParams(
-            uint32_t trackerId,
-            std::vector<uint32_t> &blockSizes) : m_blockSizes(blockSizes)
-        {
-            m_trackerId = trackerId;
-        }
-        virtual ~AcquireParams() {}
-
-        //! \brief Block sizes to allocate
-        std::vector<uint32_t>   &m_blockSizes;
-        //! \brief Requested block alignment
-        uint32_t                m_alignment = 0;
-        //! \brief Index to the frame tracker
-        uint32_t                m_trackerIndex = 0;
-        //! \brief Must be valid, used for determining whether or not a the block is still in use. \see m_trackerData.
-        uint32_t                m_trackerId = MemoryBlockInternal::m_invalidTrackerId;
-        //! \brief Zero memory blocks after allocation
-        bool                    m_zeroAssignedBlock = false;
-        //! \brief Block allocations are flaged as static are expected to be controlled by the client. \see HeapManager::Behavior::clientControlled.
-        bool                    m_staticBlock = false;
-    };
-
-    MemoryBlockManager() { HEAP_FUNCTION_ENTER; }
-    virtual ~MemoryBlockManager();
-
-protected:
-    //!
-    //! \brief  Acquires space within the heap(s)
-    //! \param  [in] params
-    //!         Parameters describing the requested space
-    //! \param  [out] blocks
-    //!         A vector containing the memory blocks allocated
-    //! \param  [out] spaceNeeded
-    //!         Amount of space that the heap(s) are short of to complete space acquisition
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS AcquireSpace(
-        AcquireParams &params,
-        std::vector<MemoryBlock> &blocks,
-        uint32_t &spaceNeeded);
-
-    //!
-    //! \brief  Indicates that the client is done editing the blocks
-    //! \param  [in] blocks
-    //!         Blocks to be submitted
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS SubmitBlocks(std::vector<MemoryBlock> &blocks);
-
-    //!
-    //! \brief   Either directly adds a block to the free list, or prepares it to be added
-    //! \param   [in] block
-    //!          Block to be removed
-    //! \return  MOS_STATUS
-    //!          MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS ClearSpace(MemoryBlock &block);
-
-    //! \brief   Reclaims free memory based on whether or not blocks are no longer in use \see m_trackerData
-    //! \param   [out] blocksUpdated
-    //!          If true blocks have been updated, if false, no blocks were updated
-    //! \return  MOS_STATUS
-    //!          MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS RefreshBlockStates(bool &blocksUpdated);
-
-    //!
-    //! \brief  Stores heap and initializes memory blocks for future use.
-    //! \param  [in] heapId
-    //!         ID for the heap to be created
-    //! \param  [in] size
-    //!         Size of the heap to be created.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS RegisterHeap(uint32_t heapId, uint32_t size, bool hwWriteOnly = false);
-
-    //!
-    //! \brief  Removes the specified heap from the block manager, this occurs when the
-    //!         heap is in the process of being deleted. Ensures heap is not in use.
-    //! \param  [in] heapId
-    //!         ID for heap to be removed.
-    //!
-    MOS_STATUS UnregisterHeap(uint32_t heapId);
-
-    //!
-    //! \brief  Completes heap deletion for all heaps with unused space in the deleted heaps list.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS CompleteHeapDeletion();
-
-    //!
-    //! \brief  Registers the tracker data to be used for determining whether a
-    //!         memory block is available.
-    //! \param  [in] trackerData
-    //!         Must be valid. See description in \see MemoryBlockManager::m_trackerData.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS RegisterTrackerResource(uint32_t *trackerData);
-
-    //!
-    //! \brief  Registers the tracker producer to be used for determining whether a
-    //!         memory block is available. This function has a higher priority than
-    //!         RegisterTrackerResource, so if it is called, the trackerResource will
-    //!         be useless.
-    //! \param  [in] trackerProducer
-    //!         Must be valid; pointer to trackerProducer.
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS RegisterTrackerProducer(FrameTrackerProducer *trackerProducer);
-
-    //!
-    //! \brief  Gets the size of the all heaps
-    //! \return The size of all heaps managed \see m_size
-    //!
-    uint32_t GetSize() { return m_totalSizeOfHeaps; }
-
-    //!
-    //! \brief  Determines whether a valid tracker data has been registered
-    //! \return True if the pointer is valid, false otherwise
-    //!
-    bool IsTrackerDataValid()
-    {
-        return (!m_useProducer && m_trackerData != nullptr)
-            || (m_useProducer && m_trackerProducer != nullptr);
-    }
-
-    //!
-    //! \brief   All heaps allocated are locked and kept locked for their lifetimes
-    //! \details May only be set before any heaps are allocated.
-    //! \return  MOS_STATUS
-    //!          MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS LockHeapsOnAllocate()
-    {
-        HEAP_FUNCTION_ENTER;
-        if (m_totalSizeOfHeaps != 0)
-        {
-            HEAP_ASSERTMESSAGE("Locking heaps on allocate may only be set before heaps are allocated");
-            return MOS_STATUS_UNKNOWN;
-        }
-        m_lockHeapsOnAllocate = true;
-        return MOS_STATUS_SUCCESS;
-    }
-
-private:
-    //! \brief Describes the information managed by this class for each heap registered
-    struct HeapWithAdjacencyBlockList
-    {
-        HeapWithAdjacencyBlockList()
-        {
-            HEAP_FUNCTION_ENTER;
-        }
-
-        virtual ~HeapWithAdjacencyBlockList()
-        {
-            HEAP_FUNCTION_ENTER;
-            MOS_Delete(m_heap);
-            auto curr = m_adjacencyListBegin;
-            MemoryBlockInternal *next = nullptr;
-
-            while (curr != nullptr)
-            {
-                next = curr->GetNext();
-                MOS_Delete(curr);
-                curr = next;
-            }
-        }
-
-        //! \brief Heap which all other members of this struct define.
-        Heap *m_heap = nullptr;
-        //! \brief The list of blocks in the heap arranged by offset in the heap. The head is a dummy block.
-        MemoryBlockInternal *m_adjacencyListBegin = nullptr;
-        //! \brief The size of the heap
-        uint32_t m_size = 0;
-    };
-
-    //!
-    //! \brief  Stores the provided OS interface in the heap
-    //! \param  [in] osInterface
-    //!         Must be valid
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!  
-    MOS_STATUS RegisterOsInterface(PMOS_INTERFACE osInterface);
-
-    //!
-    //! \brief  Determines whether or not space is available, if not enough space returns
-    //!         the amount short in \a spaceNeeded
-    //! \param  [in] sortedSizes
-    //!         Requested block sizes sorted in decending order.
-    //! \param  [in] params
-    //!         Parameters describing the requested space
-    //! \param  [out] spaceNeeded
-    //!         Amount of space that the heap(s) are short of to complete space acquisition
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS IsSpaceAvailable(
-        AcquireParams &params,
-        uint32_t &spaceNeeded);
-
-    //!
-    //! \brief  Sets up memory blocks for the requested space
-    //! \param  [in] sortedSizes
-    //!         Requested block sizes sorted in decending order with original index saved from params.
-    //! \param  [in] params
-    //!         Parameters describing the requested space
-    //! \param  [out] blocks
-    //!         A vector containing the memory blocks allocated
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS AllocateSpace(
-        AcquireParams &params,
-        std::vector<MemoryBlock> &blocks);
-
-    //!
-    //! \brief  Sets up memory blocks for the requested space
-    //! \param  [in] alignedSize
-    //!         Aligned size of the memory requested
-    //! \param  [in] trackerId
-    //!         Tracker ID to be used for the allocated block
-    //! \param  [in] staticBlock
-    //!         Indicates that the newly created block is expected to be static
-    //! \param  [out] freeBlock
-    //!         Free block that will be used for the allocation of the new block
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS AllocateBlock(
-        uint32_t alignedSize,
-        uint32_t trackerId,
-        bool staticBlock,
-        MemoryBlockInternal *freeBlock);
-
-    //!
-    //! \brief  Sets up memory blocks for the requested space
-    //! \param  [in] alignedSize
-    //!         Aligned size of the memory requested
-    //! \param  [in] trackerIndex
-    //!         Tracker index to be used for the allocated block
-    //! \param  [in] trackerId
-    //!         Tracker ID to be used for the allocated block
-    //! \param  [in] staticBlock
-    //!         Indicates that the newly created block is expected to be static
-    //! \param  [out] freeBlock
-    //!         Free block that will be used for the allocation of the new block
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS AllocateBlock(
-        uint32_t alignedSize,
-        uint32_t trackerIndex,
-        uint32_t trackerId,
-        bool staticBlock,
-        MemoryBlockInternal *freeBlock);
-
-    //!
-    //! \brief  Sets up memory blocks for the requested space
-    //! \param  [in] block
-    //!         Block to be added to the sorted pool of type \a state
-    //! \param  [in] state
-    //!         Type of pool to be added to
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS AddBlockToSortedList(
-        MemoryBlockInternal *block,
-        MemoryBlockInternal::State state);
-
-    //!
-    //! \brief  Sets up memory blocks for the requested space
-    //! \param  [in] block
-    //!         Block to be added to the sorted pool of type \a state
-    //! \param  [in] state
-    //!         Type of pool to be added to, may not be of type MemoryBlockInternal::State::pool since a separate function is dedicated to that case. \see GetBlockFromPool
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS RemoveBlockFromSortedList(
-        MemoryBlockInternal *block,
-        MemoryBlockInternal::State state);
-
-    //!
-    //! \brief  Gets a pool type block from the sorted block pool, if pool is empty allocates a new one
-    //!         \see m_sortedBlockList[MemoryBlockInternal::State::pool]
-    //! \return MemoryBlockInternal*
-    //!         Valid pointer if success, nullptr if fail
-    //!
-    MemoryBlockInternal* GetBlockFromPool();
-
-    //!
-    //! \brief  Removes all blocks with heaps matching \a heapId from the sorted block pool for \a state. \see m_sortedBlockList
-    //! \param  [in] heapId
-    //!         Heap whose blocks should be removed
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS RemoveHeapFromSortedBlockList(
-        uint32_t heapId);
-
-    //!
-    //! \brief  Merges two contiguous blocks into one.
-    //! \param  [in,out] blockCombined
-    //!         Block into which \a blockRelease will be merged in to, this block is the output of the merge
-    //! \param  [in] blockRelease
-    //!         Block to be merged into \a blockCombined, this block will be added back to the pool after the merge
-    //! \return MOS_STATUS
-    //!         MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    MOS_STATUS MergeBlocks(
-        MemoryBlockInternal *blockCombined,
-        MemoryBlockInternal *blockRelease);
-
-    //!
-    //! \brief  Temporary function while MOS utilities function is added for smart pointers
-    //! \return std::shared_ptr<T>
-    //!         Valid pointer if success, nullptr if fail
-    //!
-    template <class T, class... Args>
-    std::shared_ptr<T> MakeShared(Args&&... args)
-    {
-        std::shared_ptr<T> block = nullptr;
-        try
-        {
-            block = std::make_shared<T>(args...);
-        }
-        catch (const std::bad_alloc& e)
-        {
-            HEAP_ASSERTMESSAGE("Allocation of memory block failed!");
-            return nullptr;
-        }
-        return block;
-    }
-
-
-    //! \brief  Used to retain information about the requested block sizes after those
-    //!         sizes are sorted for the return of blocks.\see AcquireParams::m_blockSizes \see AcquireSpace
-    struct SortedSizePair
-    {
-        //! \brief Constructs SortedSizePair
-        SortedSizePair() {}
-        SortedSizePair(uint32_t originalIdx, uint32_t blockSize)
-            : m_originalIdx(originalIdx), m_blockSize(blockSize) {}
-        uint32_t m_originalIdx = 0; //!< Original index of the requested block size \see AcquireParams::m_blockSizes
-        uint32_t m_blockSize = 0;   //!< Aligned block size
-    };
-
-    //! \brief Alignment for blocks in heap, currently fixed at a cacheline
-    static const uint16_t m_blockAlignment = 64;
-    //! \brief Alignment for heap, currently fixed at a page
-    static const uint16_t m_heapAlignment = MOS_PAGE_SIZE;
-    //! \brief Number of submissions before a refresh, currently fixed
-    static const uint16_t m_numSubmissionsForRefresh = 128;
-
-    //! \brief Total size of all managed heaps.
-    uint32_t m_totalSizeOfHeaps = 0;
-    //! \brief The list of block pools per heap
-    std::list<std::shared_ptr<HeapWithAdjacencyBlockList>> m_heaps;
-    //! \brief List of block pools per heap for heaps in deletion process
-    std::list<std::shared_ptr<HeapWithAdjacencyBlockList>> m_deletedHeaps;
-    //! \brief Pools of memory blocks sorted by their states based on the state indicated
-    //!        by the latest TrackerId. The free pool is sorted in ascending order.
-    MemoryBlockInternal *m_sortedBlockList[MemoryBlockInternal::State::stateCount] = {nullptr};
-    //! \brief Number of entries in each sorted block list.
-    uint32_t m_sortedBlockListNumEntries[MemoryBlockInternal::State::stateCount] = {0};
-    //! \brief Sizes of each block pool.
-    //! \brief MemoryBlockInternal::State::pool type blocks have no size, and thus that pool also is expected to be size 0.
-    uint32_t m_sortedBlockListSizes[MemoryBlockInternal::State::stateCount] = {0};
-    //! \brief   Used to compare to a memory block's tracker ID. If the value is greater
-    //!          than the tracker ID, then the block is no longer in use and may be reclaimed
-    //!          as free space, or if the block is static transitioned to allocated state so
-    //!          it may be re-used. \see MemoryBlockInternal::m_trackerId
-    //! \details The client is expected to manage this tracker; it should be valid for the
-    //!          life of the heap manager. The tracker may be updated at whatever granularity is
-    //!          appropriate--per workload, per frame, etc. It is expected that when the
-    //!          tracker data indicates that all blocks with tracker IDs less than or equal
-    //!          to the udpated value may be re-used.
-    uint32_t *m_trackerData = nullptr;
-    PMOS_INTERFACE m_osInterface = nullptr; //!< OS interface used for managing graphics resources
-    bool m_lockHeapsOnAllocate = false;             //!< All heaps allocated with the keep locked flag.
-    
-    //! \brief Persistent storage for the sorted sizes used during AcquireSpace()
-    std::list<SortedSizePair> m_sortedSizes;
-    //! \brief TrackerProducer
-    FrameTrackerProducer *m_trackerProducer = nullptr;
-    //! \bried Whether trackerProducer is set
-    bool m_useProducer = false;
-};
-#endif // __MEMORY_BLOCK_MANAGER_H__
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/media_srcs.cmake 22.5.1+ds1-1/media_driver/agnostic/common/hw/media_srcs.cmake
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/media_srcs.cmake	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/media_srcs.cmake	2022-07-19 15:03:31.000000000 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2017-2020, Intel Corporation
+# Copyright (c) 2017-2022, Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -26,7 +26,6 @@ set(TMP_1_SOURCES_
 )
 
 set(TMP_1_HEADERS_
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_sfc.h
     ${CMAKE_CURRENT_LIST_DIR}/mhw_sfc_generic.h
 )
 
@@ -35,96 +34,57 @@ set(TMP_2_SOURCES_
 )
 
 set(TMP_2_HEADERS_
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_vebox.h
     ${CMAKE_CURRENT_LIST_DIR}/mhw_vebox_generic.h
 )
 
-set(SOURCES_
-    ${SOURCES_}
-    ${TMP_1_SOURCES_}
-    ${TMP_2_SOURCES_}
-)
-
-set(HEADERS_
-    ${HEADERS_}
-    ${TMP_1_HEADERS_}
-    ${TMP_2_HEADERS_}
-)
-
-set(COMMON_SOURCES_
-    ${COMMON_SOURCES_}
-    ${TMP_1_SOURCES_}
-    ${TMP_2_SOURCES_}
-)
-
-set(COMMON_HEADERS_
-    ${COMMON_HEADERS_}
-    ${TMP_1_HEADERS_}
-    ${TMP_2_HEADERS_}
-)
-
 source_group("MHW\\SFC" FILES ${TMP_1_SOURCES_} ${TMP_1_HEADERS_})
 source_group("MHW\\VEBOX" FILES ${TMP_2_SOURCES_} ${TMP_2_HEADERS_})
 
 
 set(TMP_4_SOURCES_
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_block_manager.c
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_memory_pool.c
     ${CMAKE_CURRENT_LIST_DIR}/mhw_mi.cpp
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_render.c
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_state_heap.c
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_render_legacy.c
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_state_heap_legacy.c
     ${CMAKE_CURRENT_LIST_DIR}/mhw_utilities.c
 )
 
 set(TMP_4_HEADERS_
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_block_manager.h
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_memory_pool.h
     ${CMAKE_CURRENT_LIST_DIR}/mhw_mi_generic.h
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_render_legacy.h
     ${CMAKE_CURRENT_LIST_DIR}/mhw_render_generic.h
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_state_heap.h
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_state_heap_legacy.h
     ${CMAKE_CURRENT_LIST_DIR}/mhw_state_heap_generic.h
 )
 
-set(SOURCES_
-    ${SOURCES_}
-    ${TMP_4_SOURCES_}
-)
+source_group("MHW" FILES ${TMP_4_SOURCES_} ${TMP_4_HEADERS_})
 
-set(HEADERS_
-    ${HEADERS_}
-    ${TMP_4_HEADERS_}
+set(TMP_5_SOURCES_
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_blt_legacy.cpp
 )
 
-set(COMMON_SOURCES_
-    ${COMMON_SOURCES_}
-    ${TMP_4_SOURCES_}
+set(TMP_5_HEADERS_
+    ${CMAKE_CURRENT_LIST_DIR}/mhw_blt_legacy.h
 )
 
 set(COMMON_HEADERS_
     ${COMMON_HEADERS_}
+    ${TMP_1_HEADERS_}
+    ${TMP_2_HEADERS_}
     ${TMP_4_HEADERS_}
+    ${TMP_5_HEADERS_}
 )
 
-source_group("MHW" FILES ${TMP_4_SOURCES_} ${TMP_4_HEADERS_})
-
-set(TMP_5_SOURCES_
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_blt.cpp
-)
-
-set(TMP_5_HEADERS_
-    ${CMAKE_CURRENT_LIST_DIR}/mhw_blt.h
-)
-
-set(SOURCES_
-    ${SOURCES_}
+set(COMMON_SOURCES_
+    ${COMMON_SOURCES_}
+    ${TMP_1_SOURCES_}
+    ${TMP_2_SOURCES_}
+    ${TMP_4_SOURCES_}
     ${TMP_5_SOURCES_}
 )
 
-set(HEADERS_
-    ${HEADERS_}
-    ${TMP_5_HEADERS_}
-)
-
 source_group("MHW\\BLT" FILES ${TMP_5_SOURCES_} ${TMP_5_HEADERS_})
 
-media_add_curr_to_include_path()
+set(COMMON_PRIVATE_INCLUDE_DIRS_
+    ${COMMON_PRIVATE_INCLUDE_DIRS_}
+    ${CMAKE_CURRENT_LIST_DIR}
+)
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_block_manager.c 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_block_manager.c
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_block_manager.c	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_block_manager.c	1970-01-01 00:00:00.000000000 +0000
@@ -1,1721 +0,0 @@
-/*
-* Copyright (c) 2015-2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file      mhw_block_manager.c 
-//! \brief         This modules implements memory block management functions as part of MHW     dynamic state heap implementation 
-//!
-#include "mhw_block_manager.h"
-#include "mhw_utilities.h"
-#include "mos_os_specific.h"
-
-MHW_BLOCK_MANAGER_PARAMS MhwBlockManagerParams_default =
-{
-    64,                                // Initial number of block objects in pool
-    1024,                              // Maximum number of block objects in pool
-    64,                                // Block pool increment size
-    0x00080000,                        // Initial heap size         (512k)
-    0x00080000,                        // Heap size increment       (512k)
-    0x01000000,                        // Maximum overall heap size (16M)
-    32,                                // Maximum number of heaps (32) (512k x 32 = 16M)
-    0x0800,                            // Block granularity   = 2k (also represents min block alignment)
-    0x0800                             // Min free block size = 2k (to reduce fragmentation)
-};
-
-const char *szListName[MHW_BLOCK_STATE_COUNT] = {
-    "POOL",
-    "FREE",
-    "ALLOCATED",
-    "SUBMITTED",
-    "DELETED"
-};
-
-void Mhw_BlockManager_ReverseMergeSort_With_Index(const uint32_t *pdwSizes, int32_t iCount, uint8_t *pSortedIndex)
-{
-    uint8_t i, n;
-    uint8_t *pSrc, *pDst;                               // Source and Destination groups (alternate)
-    uint8_t Index1[MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY];  // Temporary sorted indexes 1
-    uint8_t Index2[MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY];  // Temporary sorted indexes 2 (alternating with Index1)
-    uint8_t *s1, *s2;                                   // Merge source groups 1 and 2
-    uint8_t n1, n2;                                     // Merge sizes  groups 1 and 2
-    uint8_t *d;                                         // Merge destination
-
-    // Very simple cases
-    if (iCount <= 1)
-    {
-        pSortedIndex[0] = 0;
-        return;
-    }
-    else if (iCount == 2)
-    {
-        pSortedIndex[0] = (pdwSizes[0] < pdwSizes[1]) ? 1 : 0;
-        pSortedIndex[1] = 1 - pSortedIndex[0];
-        return;
-    }
-
-    // Initialize sorted index table
-    for (i = 0; i < iCount; i++)
-    {
-        Index1[i] = i;
-    }
-
-    // Start alternating buffers (last will be the actual output)
-    pSrc = Index1;
-    pDst = Index2;
-
-    // Merge sort algorithm:
-    //      Sort will perform O(log n) passes; first pass sorts (iCount/2) groups of 2, then (iCount/4) groups of 4, and so on.
-    //      Each pass requires traversal of the entire list - O(n)
-    //      Algorithm is expected to be O(n * log n)
-    for (n = 1; n < iCount; n *= 2)
-    {
-        // Setup sorted target output
-        if (n*2 < iCount)
-        {
-            d = pDst;
-        }
-        else
-        {   // Last pass, output goes to caller
-            d = pSortedIndex;
-        }
-
-        // Group selection and merge - O(n)
-        s1 = pSrc - n;    // First  group
-        s2 = pSrc;        // Second group
-        for (i = n; i < iCount; i += 2*n)   // i is the offset of the 2nd group
-        {
-            s1 += n;
-            n1 = n;
-            s2 += n;
-            n2 = n;
-
-            // Limit size of last group
-            if (i + n > iCount)
-            {
-                n2 = iCount - i;
-            }
-
-            // Merge groups
-            while (n1 > 0 && n2 > 0)
-            {
-                if (pdwSizes[*s1] >= pdwSizes[*s2])
-                {
-                    *(d++) = *(s1++);
-                    n1--;
-                }
-                else
-                {
-                    *(d++) = *(s2++);
-                    n2--;
-                }
-            }
-
-            // Merge remaining items
-            while (n1 > 0)
-            {
-                *(d++) = *s1++;
-                n1--;
-            }
-            while (n2 > 0)
-            {
-                *(d++) = *s2++;
-                n2--;
-            }
-        }
-
-        // Copy the last group (not merge-sorted)
-        for (i = i - n; i < iCount; i++)
-        {
-            *(d++) = *(s2++);
-        }
-
-        // New pass, switch Src/Dst sorted index buffers
-        d    = pDst;
-        pDst = pSrc;
-        pSrc = d;
-    }
-}
-
-void Mhw_BlockManager_ReverseMergeSort(uint32_t *pdwSizes, int32_t iCount)
-{
-    uint8_t i, n;
-    uint32_t *pSrc, *pDst;                                     // Source and Destination groups (alternate)
-    uint32_t Buffer1[2 * MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY];   // Temporary sorted buffer 1
-    uint32_t Buffer2[2 * MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY];   // Temporary sorted buffer 1
-    uint32_t *s1, *s2;                                         // Merge source groups 1 and 2
-    uint8_t n1, n2;                                            // Merge sizes  groups 1 and 2
-    uint32_t *d;                                               // Merge destination
-
-    // Very simple cases
-    if (iCount <= 1)
-    {
-        return;
-    }
-    else if (iCount == 2)
-    {
-        if (pdwSizes[0] < pdwSizes[1])
-        {
-            uint32_t tmp   = pdwSizes[1];
-            pdwSizes[1] = pdwSizes[0];
-            pdwSizes[0] = tmp;
-        }
-        return;
-    }
-    else if (iCount > 2 * MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY)
-    {
-        return;
-    }
-
-    // Merge sort algorithm:
-    //      Sort will perform O(log n) passes; first pass sorts (iCount/2) groups of 2, then (iCount/4) groups of 4, and so on.
-    //      Each pass requires traversal of the entire list - O(n)
-    //      Algorithm is expected to be O(n * log n)
-    pSrc = Buffer1;
-    pDst = Buffer2;
-    for (n = 1; n < iCount; n *= 2)
-    {
-        if (n == 1)
-        {
-            s1 = pdwSizes - 1;
-            s2 = pdwSizes;
-        }
-        else
-        {
-            s1 = pSrc - n;
-            s2 = pSrc;
-        }
-
-        // Setup sorted target output
-        if (n*2 < iCount)
-        {
-            d = pDst;
-        }
-        else
-        {   // Last pass, output goes to caller
-            d = pdwSizes;
-        }
-
-        // Group selection and merge - O(n)
-        for (i = n; i < iCount; i += 2*n)   // i is the offset of the 2nd group
-        {
-            s1 += n;
-            n1 =  n;
-            s2 += n;
-            n2 =  n;
-
-            // Limit size of last group
-            if (i + n > iCount)
-            {
-                n2 = iCount - i;
-            }
-
-            // Merge groups
-            while (n1 > 0 && n2 > 0)
-            {
-                if (*s1 >= *s2)
-                {
-                    *(d++) = *(s1++);
-                    n1--;
-                }
-                else
-                {
-                    *(d++) = *(s2++);
-                    n2--;
-                }
-            }
-
-            // Merge remaining items
-            while (n1 > 0)
-            {
-                *(d++) = *s1++;
-                n1--;
-            }
-            while (n2 > 0)
-            {
-                *(d++) = *s2++;
-                n2--;
-            }
-        }
-
-        // Copy the last group (not merge-sorted)
-        for (i = i - n; i < iCount; i++)
-        {
-            *(d++) = *(s2++);
-        }
-
-        // New pass, switch Src/Dst
-        d    = pDst;
-        pDst = pSrc;
-        pSrc = d;
-    }
-}
-
-MHW_BLOCK_MANAGER::MHW_BLOCK_MANAGER(PMHW_BLOCK_MANAGER_PARAMS pParams):
-    m_MemoryPool(sizeof(MHW_STATE_HEAP_MEMORY_BLOCK), sizeof(void *)),
-    m_pStateHeap(nullptr)
-{
-    //Init Parameters
-    if(pParams != nullptr)
-    {
-        m_Params = *pParams;
-    }
-    else
-    {
-        m_Params = MhwBlockManagerParams_default;
-    }
-
-    //Init Memory block list
-    for (int32_t i = (int32_t)MHW_BLOCK_STATE_POOL; i < MHW_BLOCK_STATE_COUNT; i++)
-    {
-        MOS_ZeroMemory(&m_BlockList[i], sizeof(MHW_BLOCK_LIST));
-        m_BlockList[i].BlockState    = (MHW_BLOCK_STATE) i;
-        m_BlockList[i].pBlockManager = this;
-        MOS_SecureStrcpy(m_BlockList[i].szListName, 16, szListName[i]);
-    }
-
-    //Extend Pool
-    ExtendPool(m_Params.dwPoolInitialCount);
-}
-
-MHW_BLOCK_MANAGER::~MHW_BLOCK_MANAGER()
-{
-
-}
-
-void MHW_BLOCK_MANAGER::SetStateHeap(PMHW_STATE_HEAP pStateHeap)
-{
-    if (pStateHeap)
-    {
-        m_pStateHeap = pStateHeap;
-    }
-    return;
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::RegisterStateHeap(
-    PMHW_STATE_HEAP    pStateHeap)
-{
-    MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
-
-    // Setup state heap associated with the memory block manager
-    if (!m_pStateHeap)
-    {
-        m_pStateHeap = pStateHeap;
-    }
-
-    // Indicates that state heap is now being managed by this block manager object
-    pStateHeap->pBlockManager = this;
-
-    // Get memory block object to represent the state heap memory (free)
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock = GetBlockFromPool();
-    if (!pBlock)
-    {
-        return MOS_STATUS_NO_SPACE;
-    }
-
-    // Setup block parameters
-    pBlock->pStateHeap          = pStateHeap;           // Points to state heap
-    pBlock->pHeapPrev           = nullptr;                 // First Block in current heap
-    pBlock->pHeapNext           = nullptr;                 // Last Block in current heap
-    pBlock->dwOffsetInStateHeap = 0;                    // Offset is 0 = base of state heap
-    pBlock->dwBlockSize         = pStateHeap->dwSize;   // Size of the entire state heap
-    FrameTrackerTokenFlat_Validate(&pBlock->trackerToken);
-    pBlock->bStatic             = 0;
-
-    // Set first/last memory block in state heap
-    pStateHeap->pMemoryHead     = pBlock;
-    pStateHeap->pMemoryTail     = pBlock;
-
-    // Reset special state heap controls
-    pStateHeap->pDebugKernel    = nullptr;                 // Debug kernel loaded in this heap (if ISH)
-    pStateHeap->pScratchSpace   = nullptr;                 // Active scratch space in this heap (if GSH)
-    pStateHeap->dwScratchSpace  = 0;                    // Current scratch space size in this heap
-
-    // Insert block at the end of the free memory pool
-    AttachBlock(MHW_BLOCK_STATE_FREE, pBlock, MHW_BLOCK_POSITION_TAIL);
-
-    return eStatus;
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::UnregisterStateHeap(
-    PMHW_STATE_HEAP    pStateHeap)
-{
-    MHW_STATE_HEAP_MEMORY_BLOCK *pBlock;
-
-    bool bReleaseHeap = true;
-
-    // Verification loop - check if heap can be freed
-    for (pBlock = pStateHeap->pMemoryHead; pBlock != nullptr; pBlock = pBlock->pHeapNext)
-    {
-        // Move blocks not in use to deleted queue - so they cannot be reused
-        // NOTE: Blocks in SUBMITTED state need to wait for completion before releasing
-        if (pBlock->BlockState == MHW_BLOCK_STATE_FREE ||
-            pBlock->BlockState == MHW_BLOCK_STATE_ALLOCATED)
-        {
-            // Update heap usage
-            if (pBlock->BlockState == MHW_BLOCK_STATE_FREE)
-            {
-                pStateHeap->dwFree -= pBlock->dwBlockSize;
-            }
-            else
-            {
-                pStateHeap->dwUsed -= pBlock->dwBlockSize;
-            }
-
-            DetachBlock(pBlock->BlockState, pBlock);
-            AttachBlock(MHW_BLOCK_STATE_DELETED, pBlock, MHW_BLOCK_POSITION_TAIL);
-        }
-        // Block is allocated or submitted - mark block for deletion when released
-        else if (pBlock->BlockState != MHW_BLOCK_STATE_DELETED)
-        {
-            pBlock->bStatic = false;    // Unlock block
-            pBlock->bDelete = true;     // Mark block for deletion when done
-            bReleaseHeap = false;       // Heap cannot be released at this moment
-        }
-    }
-
-    // All blocks have been sucessfully deleted -> move all blocks to pool, unregister state heap
-    if (bReleaseHeap)
-    {
-        // Return deleted blocks back to pool
-        for (pBlock = pStateHeap->pMemoryHead; pBlock != nullptr; pBlock = pBlock->pHeapNext)
-        {
-            // Sanity check - all blocks must be in this state!
-            if (pBlock->BlockState == MHW_BLOCK_STATE_DELETED)
-            {
-                DetachBlock(MHW_BLOCK_STATE_DELETED, pBlock);
-                ReturnBlockToPool(pBlock);
-            }
-            else
-            {
-                // NEVER SUPPOSED TO HAPPEN DUE TO PREVIOUS LOOP
-                MHW_ASSERTMESSAGE("ERROR: Mhw_BlockManager_UnregisterStateHeap: Invalid state, heap blocks are supposed to be all deleted by now");
-            }
-        }
-        return MOS_STATUS_SUCCESS;
-    }
-    else
-    {   // State heap cannot be unregistered because some blocks are still in use
-        return MOS_STATUS_UNKNOWN;
-    }
-}
-
-PMHW_STATE_HEAP_MEMORY_BLOCK MHW_BLOCK_MANAGER::GetBlockFromPool()
-{
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock = nullptr;
-
-    // Ran out of memory blocks... extend pool of memory block objects
-    if (m_BlockList[MHW_BLOCK_STATE_POOL].iCount == 0)
-    {
-        ExtendPool(m_Params.dwPoolIncrement);
-    }
-
-    // Retrieve block object from head of the pool
-    pBlock = DetachBlock(MHW_BLOCK_STATE_POOL, MHW_BLOCK_POSITION_HEAD);
-
-    return pBlock;
-}
-
-void MHW_BLOCK_MANAGER::ExtendPool(uint32_t  dwCount)
-{
-    uint32_t dwBlockID = m_MemoryPool.m_dwObjCount; // Block ID starts from the current block count
-
-    // Limits the number of memory blocks
-    if (m_MemoryPool.m_dwCount + dwCount > m_Params.dwPoolMaxCount)
-    {
-        dwCount = m_Params.dwPoolMaxCount - m_MemoryPool.m_dwCount;
-    }
-
-    // Extend pool of block objects
-    if (dwCount > 0)
-    {
-        // Allocate array of block objects into the pool
-        MHW_STATE_HEAP_MEMORY_BLOCK *pBlockArray = (MHW_STATE_HEAP_MEMORY_BLOCK *) (m_MemoryPool.Allocate(dwCount));
-        if (pBlockArray)
-        {
-            // Insert newly created block objects into the linked list of pool objects available to the memory block manager
-            for (; dwCount > 0; dwCount--, pBlockArray++)
-            {
-                pBlockArray->dwBlockSize = 0;
-                pBlockArray->pPrev       = pBlockArray->pNext = nullptr;
-                pBlockArray->Reserved    = dwBlockID++;
-                AttachBlock(MHW_BLOCK_STATE_POOL, pBlockArray, MHW_BLOCK_POSITION_TAIL);
-            }
-        }
-    }
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::AttachBlock(
-    MHW_BLOCK_STATE              BlockState,
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos)
-{
-    PMHW_BLOCK_LIST pList;
-    MOS_STATUS      eStatus = MOS_STATUS_SUCCESS;
-
-    // Verify parameters - objects cannot be null, block state must be valid
-    if (pBlock == nullptr ||
-        BlockState <  MHW_BLOCK_STATE_POOL ||
-        BlockState >= MHW_BLOCK_STATE_COUNT)
-    {
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    // Fails if block is still attached to a list
-    if (pBlock->pPrev || pBlock->pNext)
-    {
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    // Get list associated with block state; move block to the list
-    pList = &m_BlockList[BlockState];
-    BLOCK_MANAGER_CHK_STATUS(AttachBlockInternal(pList, BlockState, pBlock, pBlockPos));
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::AttachBlockInternal(
-    PMHW_BLOCK_LIST              pList,
-    MHW_BLOCK_STATE              BlockState,
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos)
-{
-
-    // Check if this is the correct list!
-    if (pList->BlockState != BlockState)
-    {
-        MHW_ASSERTMESSAGE("ERROR: Mhw_BlockManager_AttachBlock_Internal: Block state doesn't match the list provided");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    // Setup the block state
-    pBlock->BlockState = BlockState;
-
-    // Attaches to the head of the list
-    if (pBlockPos == MHW_BLOCK_POSITION_TAIL)
-    {
-        pBlock->pPrev = pList->pTail;
-        pBlock->pNext = nullptr;
-    }
-    // Attaches to the tail of the list
-    else if (pBlockPos == MHW_BLOCK_POSITION_HEAD)
-    {
-        pBlock->pPrev = nullptr;
-        pBlock->pNext = pList->pHead;
-    }
-    // Insert after block provided - ensures that it belongs to the same list
-    else if (pBlockPos->BlockState == BlockState)
-    {
-        pBlock->pPrev = pBlockPos;
-        pBlock->pNext = pBlockPos->pNext;
-    }
-    // Insertion point does not belong to the same list
-    else
-    {
-        MHW_ASSERTMESSAGE("ERROR: Mhw_BlockManager_AttachBlock_Internal: Reference block does not belong to the list provided");
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    // Modify previous block or head of the list
-    if (pBlock->pPrev)
-    {
-        pBlock->pPrev->pNext = pBlock;
-    }
-    else
-    {
-        pList->pHead = pBlock;
-    }
-
-    // Modify next block or tail of the list
-    if (pBlock->pNext)
-    {
-        pBlock->pNext->pPrev = pBlock;
-    }
-    else
-    {
-        pList->pTail = pBlock;
-    }
-
-    // Track size and number of blocks in the list
-    pList->dwSize += pBlock->dwBlockSize;
-    pList->iCount++;
-
-    return MOS_STATUS_SUCCESS;
-}
-
-PMHW_STATE_HEAP_MEMORY_BLOCK MHW_BLOCK_MANAGER::DetachBlock(
-    MHW_BLOCK_STATE              BlockState,
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos)
-{
-    PMHW_BLOCK_LIST              pList;
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock =  nullptr;
-
-    // Verify parameters - object cannot be null, block state must be valid
-    if (BlockState <  MHW_BLOCK_STATE_POOL ||
-        BlockState >= MHW_BLOCK_STATE_COUNT)
-    {
-        return nullptr;
-    }
-
-    // Get list associated with block state
-    pList = &m_BlockList[BlockState];
-
-    // Remove block from list, performing sanity check (check if block is in correct list)
-    pBlock = DetachBlockInternal(pList, pBlockPos);
-
-    return pBlock;
-}
-
-PMHW_STATE_HEAP_MEMORY_BLOCK MHW_BLOCK_MANAGER::DetachBlockInternal(
-    PMHW_BLOCK_LIST              pList,
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock)
-{
-
-    if(pList == nullptr)
-    {
-        return nullptr;
-    }
-
-#ifdef MHW_DYNAMIC_STATE_HEAP_LOGGING
-    const char *szPos = "REF ";
-    if (pBlock == MHW_BLOCK_POSITION_HEAD)
-        szPos = "HEAD";
-    else if (pBlock == MHW_BLOCK_POSITION_TAIL)
-        szPos = "TAIL";
-#endif
-
-    // Get block from the head of the list
-    if (pBlock == MHW_BLOCK_POSITION_HEAD)
-    {
-        pBlock = pList->pHead;
-    }
-    // Get block from the tail of the list
-    else if (pBlock == MHW_BLOCK_POSITION_TAIL)
-    {
-        pBlock = pList->pTail;
-    }
-    // Block does not belong to correct list - ASSERT and get block from head of the list
-    else if (pBlock->BlockState != pList->BlockState)
-    {
-        MHW_ASSERTMESSAGE("ERROR: Mhw_BlockManager_DetachBlock_Internal: Block provided does not belong to the list provided");
-        pBlock = nullptr;
-    }
-
-    if (!pBlock)
-    {
-        return nullptr;
-    }
-
-    // Detach block from previous; if first, update head of the list
-    if (pBlock->pPrev)
-    {
-        pBlock->pPrev->pNext = pBlock->pNext;
-    }
-    else
-    {
-        pList->pHead = pBlock->pNext;
-    }
-
-    // Detach block from next; if last, update tail of the list
-    if (pBlock->pNext)
-    {
-        pBlock->pNext->pPrev = pBlock->pPrev;
-    }
-    else
-    {
-        pList->pTail = pBlock->pPrev;
-    }
-
-    // reset pointers - block is detached
-    pBlock->pNext = pBlock->pPrev = nullptr;
-
-    // track size and number of block in the list
-    pList->dwSize -= pBlock->dwBlockSize;
-    pList->iCount--;
-
-    return pBlock;
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::MoveBlock(
-    PMHW_BLOCK_LIST              pSrcList,      // Source list
-    PMHW_BLOCK_LIST              pDstList,      // Destination list
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,        // Block to be moved (or HEAD/TAIL of source list)
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos)     // Position to insert (or HEAD/TAIL of target list)
-{
-    MOS_STATUS      eStatus = MOS_STATUS_SUCCESS;
-
-    BLOCK_MANAGER_CHK_NULL(pSrcList);
-    BLOCK_MANAGER_CHK_NULL(pDstList);
-
-    pBlock = DetachBlockInternal(pSrcList, pBlock);
-    BLOCK_MANAGER_CHK_NULL(pBlock);
-
-    eStatus = AttachBlockInternal(pDstList, pDstList->BlockState, pBlock, pBlockPos);
-
-    if (eStatus != MOS_STATUS_SUCCESS)
-    {
-        MHW_ASSERTMESSAGE("ERROR: Mhw_BlockManager_MoveBlock_Internal: Failed to move block");
-        AttachBlockInternal(pDstList, pDstList->BlockState, pBlock, MHW_BLOCK_POSITION_TAIL);
-    }
-
-    return eStatus;
-}
-
-void MHW_BLOCK_MANAGER::ReturnBlockToPool(PMHW_STATE_HEAP_MEMORY_BLOCK pBlock)
-{
-    pBlock->dwBlockSize = 0;
-    pBlock->pPrev       = pBlock->pNext = nullptr;
-
-    AttachBlock(MHW_BLOCK_STATE_POOL, pBlock, MHW_BLOCK_POSITION_TAIL);
-
-    return;
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::Refresh()
-{
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock, pNext;
-    PMHW_BLOCK_LIST              pList;
-    MOS_STATUS                   eStatus = MOS_STATUS_SUCCESS;
-
-    // Refresh status of SUBMITTED blocks
-    pList  = &m_BlockList[MHW_BLOCK_STATE_SUBMITTED];
-    pNext  = nullptr;
-    for (pBlock = pList->pHead; pBlock != nullptr; pBlock = pNext)
-    {
-        // check of block may be released - if not, continue loop
-        // NOTE - blocks are to be inserted in the sequence of execution,
-        //        so we may finish the search as soon as we find the first
-        //        block still "in use" (block tag > current sync tag)
-        //        For now we're doing an exhaustive search, but it may not be needed - once
-        //        we find the first block still in execution, we can probably stop the search
-
-        // Save next pointer before moving the block to another queue
-        pNext = pBlock->pNext;
-
-        // Check if block is still in use, if so, continue search
-        // NOTE - the following expression avoids sync tag wrapping around MAX_INT -> 0
-        if (!FrameTrackerTokenFlat_IsExpired(&pBlock->trackerToken))
-        {
-            continue;
-        }
-
-        // Block is flagged for deletion
-        if (pBlock->bDelete)
-        {
-            BLOCK_MANAGER_CHK_STATUS(FreeBlock(pBlock));
-        }
-        // Block is static -> move back to allocated list
-        else if (pBlock->bStatic)
-        {
-            BLOCK_MANAGER_CHK_STATUS(MoveBlock(pList, &m_BlockList[MHW_BLOCK_STATE_ALLOCATED],
-                           pBlock, MHW_BLOCK_POSITION_TAIL));
-        }
-        else
-        // Block is non-static  -> free block
-        {
-            FreeBlock(pBlock);
-        }
-    }
-
-    return eStatus;
-}
-
-void MHW_BLOCK_MANAGER::ConsolidateBlock(
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock)
-{
-    PMHW_STATE_HEAP_MEMORY_BLOCK pAux;
-
-    // Check input parameters
-    if (!pBlock || pBlock->BlockState != MHW_BLOCK_STATE_FREE)
-    {
-        return;
-    }
-
-    // Consolidate pBlock with previous blocks
-    PMHW_BLOCK_LIST pFree = &m_BlockList[MHW_BLOCK_STATE_FREE];
-    for (pAux = pBlock->pHeapPrev; (pAux != nullptr) && (pAux->BlockState == MHW_BLOCK_STATE_FREE); pAux = pBlock->pHeapPrev)
-    {
-        // Remove block from free block list
-        DetachBlock(MHW_BLOCK_STATE_FREE, pAux);
-
-        // Absorb free space into original block by adjusting offset/size
-        pBlock->dwOffsetInStateHeap -= pAux->dwBlockSize;
-        pBlock->dwBlockSize         += pAux->dwBlockSize;
-        pFree->dwSize               += pAux->dwBlockSize;
-
-        // Detach memory block from sequential memory list
-        pBlock->pHeapPrev = pAux->pHeapPrev;
-        if (pBlock->pHeapPrev)
-        {
-            pBlock->pHeapPrev->pHeapNext = pBlock;
-        }
-        else
-        {
-            pBlock->pStateHeap->pMemoryHead = pBlock;
-        }
-
-        // Memory block object no longer needed - return to pool after consolidation
-        ReturnBlockToPool(pAux);
-    }
-
-    // Consolidate pBlock with following blocks
-    for (pAux = pBlock->pHeapNext; (pAux != nullptr) && (pAux->BlockState == MHW_BLOCK_STATE_FREE); pAux = pBlock->pHeapNext)
-    {
-        // Remove block from free block list
-        DetachBlock(MHW_BLOCK_STATE_FREE, pAux);
-
-        // Absorb free space into original block by adjusting block size (offset remains the same)
-        pBlock->dwBlockSize += pAux->dwBlockSize;
-        pFree->dwSize       += pAux->dwBlockSize;
-
-        // Detach memory block from sequential memory list
-        pBlock->pHeapNext = pAux->pHeapNext;
-        if (pBlock->pHeapNext)
-        {
-            pBlock->pHeapNext->pHeapPrev = pBlock;
-        }
-        else
-        {
-            pBlock->pStateHeap->pMemoryTail = pBlock;
-        }
-
-        // Memory block object no longer needed - return to pool after consolidation
-        ReturnBlockToPool(pAux);
-    }
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::AllocateBlockInternal(
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
-    uint32_t                     dwAlignment)
-{
-    PMHW_STATE_HEAP pHeap;
-    MOS_STATUS      eStatus = MOS_STATUS_SUCCESS;
-    BLOCK_MANAGER_CHK_NULL(pBlock);
-
-    // Remove block from free list - if block is not in free list, this operation will fail and return nullptr
-    pBlock = DetachBlock( MHW_BLOCK_STATE_FREE, pBlock);
-    BLOCK_MANAGER_CHK_NULL(pBlock);
-
-    // Initialize block data structures
-    pBlock->bDelete      = false;
-
-    pBlock->dwDataOffset = MOS_ALIGN_CEIL(pBlock->dwOffsetInStateHeap, dwAlignment);
-    pBlock->dwAlignment  = pBlock->dwDataOffset - pBlock->dwOffsetInStateHeap;
-    pBlock->dwDataSize   = pBlock->dwBlockSize  - pBlock->dwAlignment;
-    pBlock->pDataPtr     = (uint8_t*)pBlock->pStateHeap->pvLockedHeap + pBlock->dwDataOffset;
-
-    // Move block to allocated list
-    AttachBlock(MHW_BLOCK_STATE_ALLOCATED, pBlock, MHW_BLOCK_POSITION_TAIL);
-
-    // Update available space in heap
-    pHeap = pBlock->pStateHeap;
-    pHeap->dwFree -= pBlock->dwBlockSize;
-    pHeap->dwUsed += pBlock->dwBlockSize;
-
-    return MOS_STATUS_SUCCESS;
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::SplitBlockInternal(
-    PMHW_STATE_HEAP_MEMORY_BLOCK    pBlock,
-    uint32_t                        dwSplitSize,
-    uint32_t                        dwAlignment,
-    bool                            bBackward)
-{
-    uint32_t                     dwSplitOffset = 0;
-    MOS_STATUS                   eStatus = MOS_STATUS_SUCCESS;
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlockL, pBlockH;
-
-    BLOCK_MANAGER_CHK_NULL(pBlock);
-
-    // Split cannot be less than min block size allowed
-    dwSplitSize = MOS_MAX(dwSplitSize, m_Params.dwHeapBlockMinSize);
-    if (pBlock->dwBlockSize < dwSplitSize)
-    {
-        return MOS_STATUS_UNKNOWN;
-    }
-
-    // Verify block state
-    if (pBlock->BlockState <= MHW_BLOCK_STATE_POOL  ||          // Cannot split a block object from pool (contains invalid data)
-        pBlock->BlockState >= MHW_BLOCK_STATE_DELETED)          // Cannot split a block being deleted
-    {
-        return MOS_STATUS_INVALID_PARAMETER;
-
-    }
-
-    // Select list
-    PMHW_BLOCK_LIST pList = &(m_BlockList[pBlock->BlockState]);
-
-    if (bBackward)
-    {
-        // Split FROM THE END of the block (higher offset)
-        dwSplitOffset = MOS_ALIGN_FLOOR(pBlock->dwOffsetInStateHeap + pBlock->dwBlockSize - dwSplitSize, dwAlignment);
-        dwSplitOffset = MOS_ALIGN_FLOOR(dwSplitOffset, m_Params.dwHeapGranularity);
-    }
-    else
-    {
-        // Split FROM THE BEGINNING of the block (lower offset)
-        dwSplitOffset = MOS_ALIGN_CEIL(pBlock->dwOffsetInStateHeap, dwAlignment);
-        dwSplitOffset = MOS_ALIGN_CEIL(dwSplitOffset + dwSplitSize, m_Params.dwHeapGranularity);
-    }
-
-    // Fail if block cannot be split
-    if (dwSplitOffset < pBlock->dwOffsetInStateHeap + m_Params.dwHeapBlockMinSize ||                       // First fragment is too small
-        pBlock->dwOffsetInStateHeap + pBlock->dwBlockSize < dwSplitOffset + m_Params.dwHeapBlockMinSize)   // Second fragment is too small
-    {
-        return MOS_STATUS_UNKNOWN;
-    }
-
-    if (bBackward)
-    {
-        pBlockH = pBlock;       // We'll keep the high end of the block
-        pBlockL = GetBlockFromPool();
-        BLOCK_MANAGER_CHK_NULL(pBlockL);
-
-        uint32_t reserved = pBlockL->Reserved;
-        *pBlockL = *pBlock;
-        pBlockL->Reserved = reserved;
-
-        if (pBlock->pPrev)
-        {
-            pBlock->pPrev->pNext = pBlockL;
-        }
-        else
-        {
-            pList->pHead = pBlockL;
-        }
-
-        if (pBlock->pHeapPrev)
-        {
-            pBlock->pHeapPrev->pHeapNext = pBlockL;
-        }
-        else
-        {
-            pBlock->pStateHeap->pMemoryHead = pBlockL;
-        }
-    }
-    else
-    {
-        pBlockL = pBlock;       // We'll keep the low end of the block
-        pBlockH = GetBlockFromPool();
-        BLOCK_MANAGER_CHK_NULL(pBlockH);
-
-        uint32_t reserved = pBlockH->Reserved;
-        *pBlockH = *pBlock;
-        pBlockH->Reserved = reserved;
-
-        if (pBlock->pNext)
-        {
-            pBlock->pNext->pPrev = pBlockH;
-        }
-        else
-        {
-            pList->pTail = pBlockH;
-        }
-
-        if (pBlock->pHeapNext)
-        {
-            pBlock->pHeapNext->pHeapPrev = pBlockH;
-        }
-        else
-        {
-            pBlock->pStateHeap->pMemoryTail = pBlockH;
-        }
-    }
-
-    // Update block adjacency list
-    pBlockL->pHeapNext    = pBlockH;
-    pBlockH->pHeapPrev    = pBlockL;
-
-    // Ensures that the new block is tracked in the same list as the parent block, update block count
-    pList->iCount++;
-    pBlockL->pNext = pBlockH;
-    pBlockH->pPrev = pBlockL;
-
-    // Adjust Block sizes
-    pBlockL->dwBlockSize         = dwSplitOffset - pBlockL->dwOffsetInStateHeap;   // Updates L block size based on split offset
-    pBlockH->dwOffsetInStateHeap = dwSplitOffset;                                  // Sets 2nd block offset
-    pBlockH->dwBlockSize        -= pBlockL->dwBlockSize;                           // Updates H block size by subtracting L block size
-
-    // Adjust Block data related pointers/sizes only if block is not free
-    if (pBlockL->BlockState != MHW_BLOCK_STATE_FREE)
-    {
-        pBlockL->dwDataSize  -= pBlockH->dwBlockSize;                           // Removes size of new block from amount of data available
-        pBlockH->dwDataOffset = MOS_ALIGN_CEIL(dwSplitOffset, dwAlignment);     // Adjust offset to data (accounting for alignment)
-        pBlockH->dwAlignment  = pBlockH->dwDataOffset - dwSplitOffset;          // Calculate alignment shift
-        pBlockH->dwDataSize   = pBlockH->dwBlockSize - dwAlignment;             // Adjust amount of data available
-        pBlockH->pDataPtr     = (uint8_t*)pBlockH->pStateHeap->pvLockedHeap + pBlockH->dwDataOffset; // Setup pointer to data (the heap is locked)
-    }
-
-    return eStatus;
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::MergeBlocksInternal(
-    PMHW_STATE_HEAP_MEMORY_BLOCK    pBlockL,        // block in lower memory
-    PMHW_STATE_HEAP_MEMORY_BLOCK    pBlockH,        // block in higher memory
-    uint32_t                        dwAlignment,    // final block alignment
-    bool                            bBackward)      // true if pBlockL (free) is merged into pBlockH; false if pBlockH (free) is merged into pBlockL
-{
-    PMHW_BLOCK_LIST pList;
-    MOS_STATUS      eStatus = MOS_STATUS_SUCCESS;
-
-    BLOCK_MANAGER_CHK_NULL(pBlockL);
-    BLOCK_MANAGER_CHK_NULL(pBlockH);
-
-    // Blocks must be contiguous in memory
-    if (pBlockL->pHeapNext != pBlockH ||
-        pBlockH->pHeapPrev != pBlockL)
-    {
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    // 1st block (L) is merged into 2nd (H)
-    if (bBackward)
-    {
-        if (pBlockL->BlockState != MHW_BLOCK_STATE_FREE ||      // 1st block must be free
-            pBlockH->BlockState <  MHW_BLOCK_STATE_FREE ||      // 2nd block cannot be in pool
-            pBlockH->BlockState >  MHW_BLOCK_STATE_SUBMITTED)   //           or deleted
-        {
-            return MOS_STATUS_INVALID_PARAMETER;
-        }
-
-        // Merge blocks
-        pBlockL = DetachBlock(MHW_BLOCK_STATE_FREE, pBlockL);
-        BLOCK_MANAGER_CHK_NULL(pBlockL);
-
-        pBlockH->dwOffsetInStateHeap  = pBlockL->dwOffsetInStateHeap;
-        pBlockH->dwBlockSize         += pBlockL->dwBlockSize;
-
-        // Add size to the target block list
-        pList = &(m_BlockList[pBlockH->BlockState]);
-        pList->dwSize += pBlockL->dwBlockSize;
-
-        // If block allocated or submitted, adjust data references (don't care if block is free)
-        if (pBlockH->BlockState != MHW_BLOCK_STATE_FREE)
-        {
-            pBlockH->dwDataOffset   = MOS_ALIGN_CEIL(pBlockH->dwOffsetInStateHeap, dwAlignment);
-            pBlockH->dwAlignment    = pBlockH->dwDataOffset - pBlockH->dwOffsetInStateHeap;
-            pBlockH->dwDataSize     = pBlockH->dwBlockSize  - pBlockH->dwAlignment;
-            pBlockH->pDataPtr       = (uint8_t*)pBlockH->pStateHeap->pvLockedHeap + pBlockH->dwDataOffset;
-
-            // Free block is now in use - track heap usage
-            pBlockH->pStateHeap->dwFree -= pBlockL->dwBlockSize;
-            pBlockH->pStateHeap->dwUsed += pBlockL->dwBlockSize;
-        }
-
-        // Return block object to the pool
-        ReturnBlockToPool(pBlockL);
-    }
-    else
-    // 2nd block (H) is merged into 1st (L)
-    {
-        if (pBlockH->BlockState != MHW_BLOCK_STATE_FREE ||       // 2nd block must be free
-            pBlockL->BlockState <  MHW_BLOCK_STATE_FREE ||       // 1nd block must not be in pool
-            pBlockL->BlockState >  MHW_BLOCK_STATE_SUBMITTED)    //           or deleted
-        {
-            return MOS_STATUS_INVALID_PARAMETER;
-        }
-
-        // Merge blocks
-        pBlockH = DetachBlock(MHW_BLOCK_STATE_FREE, pBlockH);
-        BLOCK_MANAGER_CHK_NULL(pBlockH);
-
-        pBlockL->dwBlockSize += pBlockH->dwBlockSize;
-        if (pBlockL->BlockState != MHW_BLOCK_STATE_FREE)
-        {
-            pBlockL->dwDataSize         += pBlockH->dwBlockSize;
-            pBlockL->pStateHeap->dwFree -= pBlockL->dwBlockSize;
-            pBlockL->pStateHeap->dwUsed += pBlockL->dwBlockSize;
-        }
-
-        // Add size to the target block list
-        pList = &(m_BlockList[pBlockL->BlockState]);
-        pList->dwSize += pBlockH->dwBlockSize;
-
-        // Return block object to the pool
-        ReturnBlockToPool(pBlockH);
-    }
-
-    return eStatus;
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::ResizeBlock(
-    PMHW_STATE_HEAP_MEMORY_BLOCK    pBlock,
-    uint32_t                        dwNewSize,
-    uint32_t                        dwAlignment,
-    bool                            bBackward)      // false => Always grow/shrink forward; true => allow block to grow forward/backwards (moving its start offset)
-{
-    MOS_STATUS                   eStatus = MOS_STATUS_SUCCESS;
-    PMHW_STATE_HEAP_MEMORY_BLOCK pNewBlock;
-
-    BLOCK_MANAGER_CHK_NULL(pBlock);
-    MHW_ASSERT(dwNewSize > 0);
-
-    // Verify block state
-    if (pBlock->BlockState <= MHW_BLOCK_STATE_POOL  ||          // Cannot touch a block object from pool - invalid data
-        pBlock->BlockState >= MHW_BLOCK_STATE_DELETED)          // Cannot touch a block being deleted
-    {
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    // Shrinking current block
-    if (dwNewSize < pBlock->dwBlockSize)
-    {
-        // Split block into 2 - (bBackwards -> shrink the block by keeping the 2nd half (anchor end of the block)
-        eStatus = SplitBlockInternal(pBlock, dwNewSize, dwAlignment, bBackward);
-        if (eStatus != MOS_STATUS_SUCCESS)
-        {
-            // This error just means that the block cannot shrink - not an actual issue here
-            if (eStatus == MOS_STATUS_UNKNOWN)
-            {
-                eStatus = MOS_STATUS_SUCCESS;
-                return eStatus;
-            }
-        }
-
-        // Select block to be freed
-        pBlock = (bBackward) ? pBlock->pPrev : pBlock->pNext;
-        BLOCK_MANAGER_CHK_NULL(pBlock);
-
-        if (pBlock->BlockState == MHW_BLOCK_STATE_SUBMITTED)
-        {
-            // mark block for release as soon it is no longer in use by GPU
-            pBlock->bStatic  = false;
-        }
-        else
-        {
-            // Free block - block is in allocated state
-            FreeBlock(pBlock);
-        }
-
-        // Success!
-        return MOS_STATUS_SUCCESS;
-    }
-
-    // Check for contiguous available space in forward direction first
-    uint32_t dwAvailable = pBlock->dwDataSize;
-    for (pNewBlock = pBlock->pHeapNext;
-         (dwAvailable < dwNewSize) && (pNewBlock) && (pNewBlock->BlockState == MHW_BLOCK_STATE_FREE);
-         pNewBlock = pNewBlock->pHeapNext)
-    {
-        dwAvailable += pNewBlock->dwBlockSize;
-    }
-
-    // Check for contiguous available space in backward direction
-    if (bBackward)
-    {
-        // Update available space to account for block alignment
-        dwAvailable += pBlock->dwAlignment - dwAlignment;
-        for (pNewBlock = pBlock->pHeapPrev;
-             (dwAvailable < dwNewSize) && (pNewBlock) && (pNewBlock->BlockState == MHW_BLOCK_STATE_FREE);
-             pNewBlock = pNewBlock->pHeapPrev)
-        {
-            dwAvailable += pNewBlock->dwBlockSize;
-        }
-    }
-
-    // Check if block can be resized
-    if (dwAvailable < dwNewSize)
-    {
-        return MOS_STATUS_UNKNOWN;
-    }
-
-    // Start block expansion forward
-    for (pNewBlock = pBlock->pHeapNext;
-         (pBlock->dwDataSize < dwNewSize) && (pNewBlock) && (pNewBlock->BlockState == MHW_BLOCK_STATE_FREE);
-         pNewBlock = pBlock->pHeapNext)
-    {
-        // Next block is too large - split the block before merging
-        if (pBlock->dwDataSize + pNewBlock->dwBlockSize > dwNewSize)
-        {
-            SplitBlockInternal(pNewBlock, dwNewSize - pBlock->dwDataSize, dwAlignment, false);
-        }
-
-        // Merge block with next
-        MergeBlocksInternal(pBlock, pNewBlock, dwAlignment, false);
-    }
-
-    // Continue expanding backward
-    if (bBackward)
-    {
-        for (pNewBlock = pBlock->pHeapPrev;
-             (dwAvailable < dwNewSize) && (pNewBlock) && (pNewBlock->BlockState == MHW_BLOCK_STATE_FREE);
-             pNewBlock = pBlock->pHeapPrev)
-        {
-            // Prev block is too large - split the block before merging
-            uint32_t dwAdjust = MOS_ALIGN_CEIL(pNewBlock->dwOffsetInStateHeap, dwAlignment) - pNewBlock->dwOffsetInStateHeap;
-            if (pBlock->dwBlockSize + pNewBlock->dwBlockSize - dwAdjust > dwNewSize)
-            {
-                SplitBlockInternal(pNewBlock, dwNewSize - pBlock->dwBlockSize, dwAlignment, true);
-            }
-
-            // Merge block with previous
-            MergeBlocksInternal(pNewBlock, pBlock, dwAlignment, true);
-        }
-    }
-
-    return eStatus;
-}
-
-PMHW_STATE_HEAP_MEMORY_BLOCK MHW_BLOCK_MANAGER::AllocateWithScratchSpace(
-    uint32_t            dwSize,
-    uint32_t            dwAlignment,
-    uint32_t            dwScratchSpace)
-{
-    MOS_STATUS                   eStatus    = MOS_STATUS_SUCCESS;
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock     = nullptr;
-    PMHW_STATE_HEAP_MEMORY_BLOCK pScratch   = nullptr;
-
-    // Fix alignment - must be a power of 2
-    if (dwAlignment < m_Params.dwHeapGranularity)
-    {
-        // Blocks are already aligned
-        dwAlignment = 1;
-    }
-    else
-    {
-        dwAlignment--;
-        dwAlignment |= dwAlignment >>  1;
-        dwAlignment |= dwAlignment >>  2;
-        dwAlignment |= dwAlignment >>  4;
-        dwAlignment |= dwAlignment >>  8;
-        dwAlignment |= dwAlignment >> 16;
-        dwAlignment++;
-    }
-
-    // Try to search search state heap with large enough scratch space
-    // and with enough free space
-    PMHW_STATE_HEAP pNextStateHeap;
-    for (PMHW_STATE_HEAP pStateHeap = m_pStateHeap; (pStateHeap); pStateHeap = pNextStateHeap)
-    {
-        // Save next state heap
-        pNextStateHeap = pStateHeap->pNext;
-
-        // Space needed for block (accounting for alignment and for scratch space)
-        uint32_t dwBlockNeeded = MOS_ALIGN_CEIL(dwSize + dwAlignment - 1, m_Params.dwHeapGranularity);
-
-        // Scratch space needed = space requested + room for alignment - space already allocated
-        uint32_t dwScratchNeeded = 0;
-        if (dwScratchSpace > 0 && pStateHeap->dwScratchSpace < dwScratchSpace)
-        {
-            dwScratchNeeded = dwScratchSpace;
-            if (m_Params.dwHeapGranularity < MHW_SCRATCH_SPACE_ALIGN)
-            {
-                dwScratchNeeded += MHW_SCRATCH_SPACE_ALIGN - m_Params.dwHeapGranularity;
-            }
-            if (pStateHeap->pScratchSpace)
-            {
-                dwScratchNeeded -= pStateHeap->pScratchSpace->dwBlockSize;
-            }
-        }
-
-        if (pStateHeap->dwSize < dwScratchNeeded)
-        {
-            // Heap is too small for current scratch space size - mark for deletion
-            pStateHeap->pMhwStateHeapInterface->ReleaseStateHeapDyn(pStateHeap);
-            continue;
-        }
-        else if (pStateHeap->dwFree < (dwScratchNeeded + dwBlockNeeded))
-        {
-            // Heap can still be used, but currently full, try next heap
-            continue;
-        }
-
-        // Allocate scratch space first
-        if (dwScratchNeeded)
-        {
-            pScratch = nullptr;
-
-            // Already present - EXPAND SCRATCH SPACE
-            if (pStateHeap->pScratchSpace)
-            {
-                // Resize existing scratch space trying to use all free space towards the end of the heap and then growing towards the center.
-                eStatus = ResizeBlock(pStateHeap->pScratchSpace, dwScratchSpace, MHW_SCRATCH_SPACE_ALIGN, true);
-                if (eStatus == MOS_STATUS_SUCCESS)
-                {
-                    pScratch = pStateHeap->pScratchSpace;                // Indicates success
-                    pStateHeap->dwScratchSpace = pScratch->dwDataSize;   // Available scratch space size (aligned)
-                }
-            }
-
-            // Scratch space not present or failed to expand - find a new scratch space
-            if (!pScratch)
-            {
-                // Search for scratch space at the end of the heap towards the beginning
-                // This model allows for better growth without collision with media state heaps
-                for (pScratch = pStateHeap->pMemoryTail; pScratch != pBlock; pScratch = pScratch->pHeapPrev)
-                {
-                    if (pScratch->BlockState == MHW_BLOCK_STATE_FREE &&
-                        pScratch->dwBlockSize >= dwScratchNeeded)
-                    {
-                        // Found scratch space large enough
-                        break;
-                    }
-                }
-
-                // Not enough contiguous space for scratch in heap - try next heap
-                if (!pScratch)
-                {
-                    continue;
-                }
-
-                // CREATE SCRATCH SPACE
-
-                // Split block to the necessary size, using the higher portion (closer to end of the heap)
-                // NOTE: Block select could be much larger than needed, even the size of the entire state heap - that's why it needs to be split
-                eStatus = SplitBlockInternal(pScratch, dwScratchNeeded, MHW_SCRATCH_SPACE_ALIGN, true);
-                if (eStatus == MOS_STATUS_UNKNOWN) eStatus = MOS_STATUS_SUCCESS;   // Don't care if block could not be split
-                if (eStatus != MOS_STATUS_SUCCESS)
-                {
-                    continue;
-                }
-
-                // Move block to allocated list, mark it as static (do not release upon completion)
-                AllocateBlockInternal(pScratch, MHW_SCRATCH_SPACE_ALIGN);
-                pScratch->bStatic = true;
-
-                // Free the old scratch space
-                // NOTE: scratch spaces are also tracked by Sync Tags and maintained in submitted/allocated lists,
-                //       If in use, it just clears the bStatic flag, so it will be freed when no longer in use.
-                if (pStateHeap->pScratchSpace)
-                {
-                    FreeBlock(pStateHeap->pScratchSpace);
-                }
-
-                // Setup new heap scratch space and size
-                pStateHeap->pScratchSpace  = pScratch;
-                pStateHeap->dwScratchSpace = pScratch->dwDataSize;
-            }
-        }
-
-        // Try to allocate block in the same heap as the scratch space
-        pBlock = AllocateBlock(dwSize, dwAlignment, pStateHeap);
-        if (pBlock)
-        {
-            break;
-        }
-    }
-
-    return pBlock;
-}
-
-PMHW_STATE_HEAP_MEMORY_BLOCK MHW_BLOCK_MANAGER::AllocateBlock(
-    uint32_t            dwSize,
-    uint32_t            dwAlignment,
-    PMHW_STATE_HEAP     pHeapAffinity)
-{
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock = nullptr;
-    PMHW_BLOCK_LIST              pFree  = &m_BlockList[MHW_BLOCK_STATE_FREE];
-    uint32_t                     dwAdjust;     // Offset adjustment for alignment purposes
-    uint32_t                     dwAllocSize;  // Actual allocation size accounting for alignment and other restrictions
-    MOS_STATUS                   eStatus = MOS_STATUS_SUCCESS;
-
-    // Fix alignment - must be a power of 2 (minimum 1)
-    if (dwAlignment) dwAlignment--;
-    dwAlignment |= dwAlignment >>  1;
-    dwAlignment |= dwAlignment >>  2;
-    dwAlignment |= dwAlignment >>  4;
-    dwAlignment |= dwAlignment >>  8;
-    dwAlignment |= dwAlignment >> 16;
-    dwAlignment++;
-
-    // Search must include space for block granularity
-    if (dwAlignment <= m_Params.dwHeapGranularity)
-    {
-        // Alignment should be fulfilled by the heap granularity
-        dwAllocSize = dwSize;
-    }
-    else
-    {
-        // Worst case scenario - original implementation was checking alignment of
-        // each free block, but it was overkill - so now we just consider the worst case
-        dwAllocSize = dwSize + dwAlignment - m_Params.dwHeapGranularity;
-    }
-
-    // Enforce min block size
-    dwAllocSize = MOS_MAX(m_Params.dwHeapBlockMinSize, dwAllocSize);
-
-    // Search list of free blocks for the first match
-    for (pBlock = pFree->pHead; pBlock != nullptr; pBlock = pBlock->pNext)
-    {
-        // Skip this heap if we are looking for allocation in a specific heap
-        if (pHeapAffinity  && pBlock->pStateHeap != pHeapAffinity)
-        {
-            continue;
-        }
-
-        // Check if aligned block fits the request -> break with a successful block
-        if (pBlock->dwBlockSize >= dwAllocSize)
-        {
-            break;
-        }
-    }
-
-    // No block was found - fail search
-    if (!pBlock)
-    {
-        return nullptr;
-    }
-
-    // Block was found, adjust the allocation size to account for
-    // heap granularity and block alignment
-    dwAdjust    = MOS_ALIGN_OFFSET(pBlock->dwOffsetInStateHeap, dwAlignment);                 // Increase in size to align data
-    dwAllocSize = MOS_ALIGN_CEIL(dwSize + dwAdjust, m_Params.dwHeapGranularity); // Account for heap granularity (avoid odd addresses in heap)
-    dwAllocSize = MOS_MAX(dwAllocSize, m_Params.dwHeapBlockMinSize);
-
-    // Just a precaution - sanity check - in case of last block in heap, and total heap size is not a multiple of granularity
-    if (pBlock->dwBlockSize < dwAllocSize)
-    {
-        // This should never happend because it is part of the search condition!
-        MHW_ASSERT(pBlock->dwBlockSize >= (dwAdjust + dwSize));
-
-        dwAllocSize = pBlock->dwBlockSize;
-    }
-
-    // Split block, move to allocated list
-    if (pBlock->dwBlockSize > dwAllocSize)
-    {
-        // Split free block in 2, keep the first part (lower offset)
-        eStatus = SplitBlockInternal(pBlock, dwAllocSize, dwAlignment, false);
-        if (eStatus != MOS_STATUS_SUCCESS &&
-            eStatus != MOS_STATUS_UNKNOWN)
-        {
-            MHW_ASSERTMESSAGE("ERROR: AllocateBlock: Failed to allocate block");
-            return nullptr;
-        }
-    }
-
-    // Move block from free to allocated queue
-    DetachBlock(MHW_BLOCK_STATE_FREE,      pBlock);
-    AttachBlock(MHW_BLOCK_STATE_ALLOCATED, pBlock, MHW_BLOCK_POSITION_TAIL);
-    pBlock->pStateHeap->dwUsed += pBlock->dwBlockSize;
-    pBlock->pStateHeap->dwFree -= pBlock->dwBlockSize;
-
-    // Reset some fields
-    pBlock->bDelete       = false;
-    FrameTrackerTokenFlat_Validate(&pBlock->trackerToken);
-
-    // Setup aligned offset, size and data
-    pBlock->dwDataOffset = MOS_ALIGN_CEIL(pBlock->dwOffsetInStateHeap, dwAlignment);
-    pBlock->dwAlignment  = pBlock->dwDataOffset - pBlock->dwOffsetInStateHeap;
-    pBlock->dwDataSize   = pBlock->dwBlockSize  - pBlock->dwAlignment;
-    pBlock->pDataPtr     = (uint8_t*)pBlock->pStateHeap->pvLockedHeap + pBlock->dwDataOffset;
-
-    // return block to client
-    return pBlock;
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::FreeBlock(
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock)
-{
-    MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
-
-    BLOCK_MANAGER_CHK_NULL(pBlock);
-
-    // Block still in use - mark for auto-release when complete
-    if (pBlock->BlockState == MHW_BLOCK_STATE_SUBMITTED)
-    {
-        // sync tag not provided or block still in use - flag it for automatic release when complete
-        if (!FrameTrackerTokenFlat_IsExpired(&pBlock->trackerToken))
-        {
-            pBlock->bStatic  = false;
-            return eStatus;
-        }
-    }
-    else if (pBlock->BlockState != MHW_BLOCK_STATE_ALLOCATED)
-    {
-        return MOS_STATUS_INVALID_PARAMETER;
-    }
-
-    // Remove block from its current list
-    DetachBlock(pBlock->BlockState, pBlock);
-
-    // If block is marked for deletion - move to deleted list so it cannot be reallocated
-    if (pBlock->bDelete)
-    {
-        MHW_STATE_HEAP *pStateHeap = pBlock->pStateHeap;
-        pStateHeap->dwUsed -= pBlock->dwBlockSize;
-
-        AttachBlock(MHW_BLOCK_STATE_DELETED, pBlock, MHW_BLOCK_POSITION_TAIL);
-
-        // Last block was removed from StateHeap -> state heap may be unregistered and deleted
-        if (pStateHeap->dwUsed == 0)
-        {
-            pStateHeap->pMhwStateHeapInterface->ReleaseStateHeapDyn(pStateHeap);
-        }
-    }
-    else
-    {
-        // Update state heap usage
-        pBlock->pStateHeap->dwUsed -= pBlock->dwBlockSize;
-        pBlock->pStateHeap->dwFree += pBlock->dwBlockSize;
-
-        // Blocks are freed and placed at the beginning of the free block list
-        AttachBlock(MHW_BLOCK_STATE_FREE, pBlock, MHW_BLOCK_POSITION_TAIL);
-
-        // Consolidate memory immediately after release - so free block are ALWAYS merged
-        ConsolidateBlock(pBlock);
-    }
-
-    return eStatus;
-}
-
-uint32_t MHW_BLOCK_MANAGER::CalculateSpaceNeeded(
-    const uint32_t      *pdwSizes,
-    int32_t             iCount,
-    uint32_t            dwAlignment,
-    bool                bHeapAffinity,
-    PMHW_STATE_HEAP     pHeapAffinity)
-{
-    uint32_t                     dwNeeded = 0;
-    uint8_t                      SortedIndex[MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY];
-    uint32_t                     FreeBlockSizes[MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY * 2];
-    uint32_t                     dwBlockOverhead = 0;   // Block size overhead to ensure alignment
-    uint32_t                     dwAllocSize;
-
-    // Check parameters
-    if (iCount <= 0 || iCount > MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY)
-    {
-        return dwNeeded;
-    }
-
-    // This is the minimum block
-    uint32_t dwBlockGranularity = m_Params.dwHeapGranularity;
-    uint32_t dwBlockMinSize     = m_Params.dwHeapBlockMinSize;
-    if (dwAlignment > dwBlockGranularity)
-    {
-        dwBlockOverhead = dwAlignment - dwBlockGranularity;
-    }
-
-    // Very simple case - single block search
-    if (iCount == 1)
-    {
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock = m_BlockList[MHW_BLOCK_STATE_FREE].pHead;
-        dwNeeded = pdwSizes[0];
-        for ( ; pBlock != nullptr && dwNeeded > 0; pBlock = pBlock->pNext)
-        {
-            if (bHeapAffinity && pHeapAffinity != pBlock->pStateHeap)
-            {
-                continue;
-            }
-
-            if (dwNeeded < pBlock->dwBlockSize)
-            {
-                dwNeeded = 0;
-            }
-        }
-
-        return dwNeeded;
-    }
-
-    // Sort input block sizes (with index, to avoid modifying the input array)
-    Mhw_BlockManager_ReverseMergeSort_With_Index(pdwSizes, iCount, SortedIndex);
-
-    // Read all available blocks, keep the largest blocks
-    int iIndex = 0;
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock = m_BlockList[MHW_BLOCK_STATE_FREE].pHead;
-    for ( ; pBlock != nullptr; pBlock = pBlock->pNext)
-    {
-        // Select free blocks that fit the request
-        if (bHeapAffinity && pHeapAffinity != pBlock->pStateHeap) continue;
-        FreeBlockSizes[iIndex++] = pBlock->dwBlockSize;
-
-        // If buffer is full, sort it, only take the largest blocks (overwrite remaining blocks)
-        if (iIndex == MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY * 2)
-        {
-            Mhw_BlockManager_ReverseMergeSort(FreeBlockSizes, iIndex);
-            iIndex = iCount;
-        }
-    }
-
-    // Final sort after all block are in
-    Mhw_BlockManager_ReverseMergeSort(FreeBlockSizes, iIndex);
-    FreeBlockSizes[iIndex] = 0; // Null termination simplifies the algorithm that follows
-
-    // Start process of fitting requested blocks with available blocks
-    uint32_t *pFreeBlock = &FreeBlockSizes[0];
-    for (iIndex = 0; iIndex < iCount; iIndex++)
-    {
-        dwAllocSize = MOS_ALIGN_CEIL(pdwSizes[SortedIndex[iIndex]] + dwBlockOverhead, dwBlockGranularity);
-        dwAllocSize = MOS_MAX(dwAllocSize, dwBlockMinSize);
-
-        // Block doesn't fit - add to space needed
-        if (dwAllocSize > *pFreeBlock)
-        {
-            dwNeeded += dwAllocSize;
-        }
-        else
-        {
-            // Allocate block
-            uint32_t dwRemaining = *pFreeBlock = *pFreeBlock - dwAllocSize;
-            uint32_t          *pAux;
-
-            // Remaining is out of order, keep list sorted using insertion sort
-            if (dwRemaining < pFreeBlock[1])
-            {
-                for (pAux = pFreeBlock; dwRemaining < pAux[1]; pAux++) pAux[0] = pAux[1];
-                pAux[0] = dwRemaining;
-            }
-        }
-    }
-
-    return dwNeeded;
-}
-
-MOS_STATUS MHW_BLOCK_MANAGER::SubmitBlock(
-    PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
-    const FrameTrackerTokenFlat  *trackerToken)
-{
-    MOS_STATUS                   eStatus = MOS_STATUS_SUCCESS;
-
-    BLOCK_MANAGER_CHK_NULL(pBlock);
-
-    if (pBlock->BlockState == MHW_BLOCK_STATE_POOL    ||        // Block cannot be submitted directly from pool
-        pBlock->BlockState == MHW_BLOCK_STATE_FREE    ||        // or from free (must be allocated first)
-        pBlock->BlockState == MHW_BLOCK_STATE_DELETED)          // or from deleted (the block is being DELETED for crying out loud!)
-    {
-        MHW_ASSERTMESSAGE("ERROR: SubmitBlock: Block in invalid state, cannot be enqueued");
-        return MOS_STATUS_UNKNOWN;
-    }
-
-    // Detach block from whatever list it's in - could be in SUBMITTED state (block is being reused - i.e., kernel or scratch space)
-    pBlock = DetachBlock(pBlock->BlockState, pBlock);
-    BLOCK_MANAGER_CHK_NULL(pBlock);
-
-    // Set block sync tag - used for refreshing the block status
-    FrameTrackerTokenFlat_Merge(&pBlock->trackerToken, trackerToken);
-
-    BLOCK_MANAGER_CHK_STATUS(AttachBlock(MHW_BLOCK_STATE_SUBMITTED, pBlock, MHW_BLOCK_POSITION_TAIL));
-
-    return eStatus;
-}
-
-PMHW_STATE_HEAP_MEMORY_BLOCK MHW_BLOCK_MANAGER::AllocateMultiple(
-    uint32_t            *pdwSizes,
-    int32_t             iCount,
-    uint32_t            dwAlignment,
-    bool                bHeapAffinity,
-    PMHW_STATE_HEAP     pHeapAffinity)
-{
-    PMHW_STATE_HEAP                pStateHeap;
-    uint32_t                       dwTotalSize = 0;
-    uint8_t                        SortedIndex[MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY];  // uint8_t is only used because the array size is <256
-    PMHW_STATE_HEAP_MEMORY_BLOCK   pBlockArray[MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY];  // This could be allocated dynamically, same for the above
-    PMHW_STATE_HEAP_MEMORY_BLOCK   pBlock;
-
-    // Clear the result
-    pBlockArray[0] = nullptr;
-
-    if (iCount <= 0 || iCount > MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY)
-    {
-        return nullptr;
-    }
-
-    // Get total allocation size
-    for (int i = 0; i < iCount; i++)
-    {
-        dwTotalSize += pdwSizes[i];
-    }
-
-    Mhw_BlockManager_ReverseMergeSort_With_Index(pdwSizes, iCount, SortedIndex);
-
-    if (bHeapAffinity)
-    {
-        if (pHeapAffinity)
-        {
-            // Set heap affinity - all blocks will be allocated from this one particular heap
-            pStateHeap = pHeapAffinity;
-        }
-        else
-        {
-            // Heap affinity is not set - start from the current active heap (most recently allocated heap)
-            pStateHeap = m_pStateHeap;
-        }
-    }
-    else
-    {   // Don't care about heap affinity, blocks can be spread across all available state heaps
-        // Just calculate total space available to make sure we have it
-        uint32_t dwTotalHeapSpace = 0;
-        for (pStateHeap = m_pStateHeap; pStateHeap != nullptr; pStateHeap = pStateHeap->pNext)
-        {
-            // Calculate total free space in all available heaps
-            // NOTE: Heap being deleted as free space set to 0
-            //       and all Free blocks are now Deleted (in deleted queue)
-            dwTotalHeapSpace += pStateHeap->dwFree;
-        }
-
-        // Not enough space
-        if (dwTotalHeapSpace < dwTotalSize)
-        {
-            return pBlockArray[0];
-        }
-    }
-
-    // Loop to try loading all kernels into the same heap
-    do {
-        if ( (!bHeapAffinity) ||                   // no affinity set -> blocks can be spread across multiple heaps
-              pStateHeap->dwFree >= dwTotalSize)   // this heap has enough free space
-        {
-            int32_t i, j;
-
-            // Allocate array according to size
-            for (i = 0, pBlock = nullptr; i < iCount; i++)
-            {   // NOTE - don't care about scratch space, already checked
-                pBlock = pBlockArray[SortedIndex[i]] = AllocateBlock(pdwSizes[SortedIndex[i]], dwAlignment, pStateHeap);
-                if (!pBlock)
-                {
-                    break;
-                }
-            }
-
-            // Allocations all sucessfull, quit search
-            if (pBlock)
-            {
-                break;
-            }
-
-            // One of the block allocations failed - free all blocks already allocated (try another heap)
-            for (j = 0; j < i; j++)
-            {
-                FreeBlock(pBlockArray[SortedIndex[j]]);
-            }
-
-            // Clear the output
-            pBlockArray[0] = nullptr;
-        }
-
-        // Try another heap if bHeapAffinity is set
-        if (bHeapAffinity)
-        {
-            pStateHeap = (pHeapAffinity) ? nullptr : pStateHeap->pNext;
-        }
-    } while (pStateHeap);
-
-    // Allocation successful, reorder blocks according to original request
-    if (pBlockArray[0])
-    {
-        for (int32_t i = 0; i < iCount; i++)
-        {
-            pBlock = DetachBlock(MHW_BLOCK_STATE_ALLOCATED, pBlockArray[i]);
-            AttachBlock(MHW_BLOCK_STATE_ALLOCATED, pBlock, MHW_BLOCK_POSITION_TAIL);
-        }
-    }
-
-    return pBlockArray[0];
-}
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_block_manager.h 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_block_manager.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_block_manager.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_block_manager.h	1970-01-01 00:00:00.000000000 +0000
@@ -1,512 +0,0 @@
-/*
-* Copyright (c) 2015-2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file      mhw_block_manager.h 
-//! \brief         This modules implements state heap block manager used in MHW 
-//!
-#ifndef __MHW_BLOCK_MANAGER_H__
-#define __MHW_BLOCK_MANAGER_H__
-
-#include "mos_os.h"
-#include "mhw_state_heap.h"
-#include "mhw_memory_pool.h"
-
-#define BLOCK_MANAGER_CHK_STATUS(_stmt)                                               \
-    MOS_CHK_STATUS_RETURN(MOS_COMPONENT_HW, MOS_HW_SUBCOMP_ALL, _stmt)
-
-#define BLOCK_MANAGER_CHK_STATUS_MESSAGE(_stmt, _message, ...)                        \
-    MOS_CHK_STATUS_MESSAGE_RETURN(MOS_COMPONENT_HW, MOS_HW_SUBCOMP_ALL, _stmt, _message, ##__VA_ARGS__)
-
-#define BLOCK_MANAGER_CHK_NULL(_ptr)                                                  \
-    MOS_CHK_NULL_RETURN(MOS_COMPONENT_HW, MOS_HW_SUBCOMP_ALL, _ptr)
-
-#define MHW_BLOCK_MANAGER_INVALID_TAG ((uint32_t)-1)
-
-// Maximum allocation array size
-#define MHW_BLOCK_MANAGER_MAX_BLOCK_ARRAY  64
-
-typedef struct _MHW_BLOCK_MANAGER_PARAMS
-{
-    uint32_t                     dwPoolInitialCount;     //!< Initial number of memory blocks in pool
-    uint32_t                     dwPoolMaxCount;         //!< Maximum number of memory blocks in pool
-    uint32_t                     dwPoolIncrement;        //!< Memory block pool increment
-    uint32_t                     dwHeapInitialSize;      //!< Initial heap size
-    uint32_t                     dwHeapIncrement;        //!< Heap size increment
-    uint32_t                     dwHeapMaxSize;          //!< Maximum overall heap size
-    uint32_t                     dwHeapMaxCount;         //!< Maximum number of heaps
-    uint32_t                     dwHeapGranularity;      //!< Block granularity
-    uint32_t                     dwHeapBlockMinSize;     //!< Minimum block fragment size (never create a block smaller than this)
-} MHW_BLOCK_MANAGER_PARAMS, *PMHW_BLOCK_MANAGER_PARAMS;
-
-#define MHW_BLOCK_POSITION_TAIL (NULL)
-#define MHW_BLOCK_POSITION_HEAD ((PMHW_STATE_HEAP_MEMORY_BLOCK) -1)
-
-typedef struct _MHW_BLOCK_LIST
-{
-    PMHW_BLOCK_MANAGER              pBlockManager;      //!< Block Manager the list belongs to
-    PMHW_STATE_HEAP_MEMORY_BLOCK    pHead;              //!< Head of the list
-    PMHW_STATE_HEAP_MEMORY_BLOCK    pTail;              //!< Tail of the list
-    MHW_BLOCK_STATE                 BlockState;         //!< Described the type of block the list contains
-    int32_t                         iCount;             //!< Number of elements on the list
-    uint32_t                        dwSize;             //!< Total memory in the list
-    char                            szListName[16];     //!< List name for debugging purposes
-} MHW_BLOCK_LIST, *PMHW_BLOCK_LIST;
-
-struct MHW_BLOCK_MANAGER
-{
-private:
-    MHW_BLOCK_MANAGER_PARAMS m_Params;                              //!< Block Manager configuration
-    MHW_MEMORY_POOL          m_MemoryPool;                          //!< Memory pool of PMHW_STATE_HEAP_MEMORY_BLOCK objects
-    MHW_BLOCK_LIST           m_BlockList[MHW_BLOCK_STATE_COUNT];    //!< Block lists associated with each block state
-    PMHW_STATE_HEAP          m_pStateHeap;                          //!< Points to state heap
-
-public:
-
-    //!
-    //! \brief    Initializes the MHW_BLOCK_MANAGER
-    //! \details  Constructor of MHW_BLOCK_MANAGER which initializes all parameters and members
-    //! \param    [in] pParams
-    //!           Pointer to block manager params. If it is null, default param will be used.
-    //!
-    MHW_BLOCK_MANAGER(PMHW_BLOCK_MANAGER_PARAMS pParams);
-
-    //!
-    //! \brief    Destructor of MHW_BLOCK_MANAGER
-    ~MHW_BLOCK_MANAGER();
-
-    //!
-    //! \brief    Adds newly created state heap to block manager
-    //! \details  Adds a new state heap to memory block manager. A new memory free memory block is added to
-    //!           the free list representing the new available heap.
-    //! \param    [in] pStateHeap
-    //!           Pointer to the newly created state heap
-    //! \return   MOS_STATUS
-    //!           Returns the status of the operation
-    //!
-    MOS_STATUS RegisterStateHeap(PMHW_STATE_HEAP    pStateHeap);
-
-    //!
-    //! \brief    Unregisters state heap from block manager prior to deallocation
-    //! \details  Removes state heap from block manager. Memory blocks must be all deleted.
-    //! \param    [in] pStateHeap
-    //!           Pointer to the newly created state heap
-    //! \return   MOS_STATUS
-    //!           Returns the status of the operation
-    //!
-    MOS_STATUS UnregisterStateHeap(PMHW_STATE_HEAP    pStateHeap);
-
-    //!
-    //! \brief    Update block states based on last executed tag
-    //! \details  Update block states based on last executed tag
-    //!           submitted unlocked blocks are released;
-    //!           move to allocated
-    //! \param    [in] dwSyncTag
-    //!           sync tag
-    //! \return   MOS_STATUS
-    //!           Returns the status of the operation
-    //!
-    MOS_STATUS Refresh();
-
-    //!
-    //! \brief    Allocate memory block with scratch space
-    //! \details  Allocate memory block with scratch space
-    //! \param    [in] dwSize
-    //!           Size of memory block to allocate 
-    //! \param    [in] dwAlignment
-    //!           Alignment
-    //! \param    [in] dwScratchSpace
-    //!           Scratch space size
-    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
-    //!           Pointer to the allocated memory block
-    //!
-    PMHW_STATE_HEAP_MEMORY_BLOCK AllocateWithScratchSpace(
-        uint32_t            dwSize,
-        uint32_t            dwAlignment,
-        uint32_t            dwScratchSpace);
-
-    //!
-    //! \brief    Allocate free block of memory
-    //! \details  Allocate free memory block of memory for use by the client
-    //! \param    [in] dwSize
-    //!           Size of memory to be allocated
-    //! \param    [in] dwAlignment
-    //!           Memory alignment
-    //! \param    [in] pHeapAffinity
-    //!           Pointer to heap affinity
-    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
-    //!           Pointer to allocated memory block
-    //!
-    PMHW_STATE_HEAP_MEMORY_BLOCK AllocateBlock(
-        uint32_t            dwSize,
-        uint32_t            dwAlignment,
-        PMHW_STATE_HEAP     pHeapAffinity);
-
-    //!
-    //! \brief    Free memory block
-    //! \details  Free memory block according to the sync tag
-    //! \param    [in] pBlock
-    //!           Pointer to memory block to be freed
-    //! \param    [in] dwSyncTag
-    //!           Sync tag
-    //! \return   MOS_STATUS
-    //!           Returns the status of the operation
-    //!
-    MOS_STATUS FreeBlock(
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock);
-
-    //!
-    //! \brief    Calculate the memory of space required
-    //! \details  Calculate the memory of space required
-    //! \param    [in] pdwSizes
-    //!           Pointer to memory block to be freed
-    //! \param    [in] iCount
-    //!           Sync tag
-    //! \param    [in] dwAlignment
-    //!           alignment
-    //! \param    [in] bHeapAffinity 
-    //!           heap affinity
-    //! \param    [in] pHeapAffinity 
-    //!           pointer to state heap affinity
-    //! \return   uint32_t Size of space needed by client
-    //!
-    uint32_t CalculateSpaceNeeded(
-        const uint32_t      *pdwSizes,
-        int32_t             iCount,
-        uint32_t            dwAlignment,
-        bool                bHeapAffinity,
-        PMHW_STATE_HEAP     pHeapAffinity);
-
-    //!
-    //! \brief    Submit memory block
-    //! \details  Submit memory block according to the sync tag
-    //! \param    [in] pBlock
-    //!           Pointer to memory block to be submitted
-    //! \param    [in] dwSyncTag
-    //!           Sync tag
-    //! \return   MOS_STATUS
-    //!           Returns the status of the operation
-    //!
-    MOS_STATUS SubmitBlock(
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
-        const FrameTrackerTokenFlat  *trackerToken);
-
-    //!
-    //! \brief    Set state heap to block manager
-    //! \details  Set state heap to block manager
-    //! \param    [in] pStateHeap
-    //!           Pointer to state heap
-    //!
-    void SetStateHeap(PMHW_STATE_HEAP pStateHeap);
-
-    // Multiple Block Allocation algorithm description (multiple kernel load):
-    //
-    // Multiple blocks must be efficiently allocated in multiple heaps or in a single heap.
-    //
-    // Each load may introduce block fragmentation. The more kernels are loaded, the greater
-    // are the chances to fragment the heap, reducing the chances of finding contiguous for a
-    // larger kernel. Therefore, the efficient way to use the heap is to load larger kernels
-    // first ensuring they have enough contiguous space, and then load the smaller kernels,
-    // which are more likely to fit in remaining blocks.
-    //
-    // So the algorithm is the following:
-    //
-    // 1) The total size of all blocks is calculated to check if there's even a fighting chance
-    //    to load them all - if the amount available is insufficient, other measures will be taken.
-    //
-    // 2) In order to allocate blocks according to size, we first sort the array of sizes
-    //    using an index array (never touching the source array!) - this is done by a merge sort
-    //    implementation, which is O(n*log(n)) - may try using other algorithm such as QuickSort -
-    //    although quicksort is not always the best (may be O(n^2) in same cases)
-    //
-    // 3) Select a specific heap (or nullptr if bHeapAffinity is false). Check if there is enough space
-    //    to load all blocks - ignoring the fragmentation for now. Only by traversing the list of
-    //    blocks we will be able to determine if the heap can be used or not. Trying to load larger
-    //    kernels FIRST helps identifying heap fragmentation issues faster than leaving it for last.
-    //
-    // 4) Load the array of kernels one at a time according to size (larger first). Select a specific
-    //    heap or nullptr (if any heap, don't care).
-    //
-    // 5) If all succeeded, then we are ready to return the list of blocks to the client.
-    //
-    // 6) If it fails, release the already allocated blocks. the algorithm does check for space in the
-    //    current heap before even starting the loop. The failure will not happen for lack of space,
-    //    but because of fragmentation of free space. In case of bHeapAffinity = false, we also check
-    //    the aggregate free space.
-    //
-    // 7) If the heap affinity is selected and the intended heap is also provided, we're done - if we
-    //    were not able to load the blocks, the overall operation has failed. If affinity is selected but
-    //    the heap was not provided, we try the next heap until no more heaps are available. This particular
-    //    situation is intended for loading all blocks in the same heap without specifying which one.
-    //
-
-    //!
-    //! \brief    Allocate multiple blocks 
-    //! \details  Allocate multiple blocks 
-    //! \param    [in]  pdwSizes
-    //!           Pointer to sizes
-    //! \param    [in]  iCount
-    //!           Count of blocks to be allocated
-    //! \param    [in] dwAlignment
-    //!           Alignment
-    //! \param    [in] bHeapAffinity
-    //!           true if all blocks must be allocated in the same heap 
-    //! \param    [in] pHeapAffinity
-    //!           Pointer to heap affinity 
-    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
-    //!           Pointer to allocated memory block
-    //!
-    PMHW_STATE_HEAP_MEMORY_BLOCK AllocateMultiple(
-        uint32_t            *pdwSizes,
-        int32_t             iCount,
-        uint32_t            dwAlignment,
-        bool                bHeapAffinity,
-        PMHW_STATE_HEAP     pHeapAffinity);
-
-private:
-
-    //!
-    //! \brief    Gets memory block from pool
-    //! \details  Gets memory block from pool, extending the pool if necessary
-    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
-    //!           Returns a pointer to the memory block, nullptr if failed to allocate or
-    //!           all blocks are in use and the pool reached its maximum size.
-    //!
-    PMHW_STATE_HEAP_MEMORY_BLOCK GetBlockFromPool();
-
-    //!
-    //! \brief    Extends pool of MHW_STATE_HEAP_MEMORY_BLOCK objects
-    //! \details  Allocates an array of MHW_STATE_HEAP_MEMORY_BLOCK objects and appends to the pool of objects for reuse.
-    //!           The allocation of memory block structures is limited to the maximum number defined when creating
-    //!           the Memory Block Manager object. The increase in number of memory blocks may be due to increased
-    //!           block fragmentation, system load or other factors (increase in queue depth, increas in memory
-    //!           blocks maintained by the client - such as number of kernels loaded).
-    //! \param    [in] dwCount
-    //!           Number of additional blocks to add to the pool
-    //! \return   N/A
-    //!
-    void ExtendPool(uint32_t dwCount);
-
-    //!
-    //! \brief    Attach block into appropriate memory block list
-    //! \details  Sets block state and inserts it into the memory block list associated with the new state.
-    //!           The block may be inserted at the "Head" or "Tail" of the list, or after another block from the same list.
-    //! \param    [in]BlockState
-    //!           New block state, defines which list the block is to be inserted.
-    //!           NOTE: The block must not belong to any other list before calling this function (pPrev/pNext = nullptr).
-    //! \param    [in] pBlock
-    //!           Pointer to memory block
-    //! \param    [in] pBlockPos
-    //!           Pointer to memory block after which the block is to be inserted (inserted AFTER pBlockPos)
-    //!           If set to MHW_BLOCK_POSITION_HEAD, inserts block at the head of the list.
-    //!           If set to MHW_BLOCK_POSITION_TAIL, inserts block at the tail of the list.
-    //! \return   MOS_STATUS
-    //!           Returns error code
-    //!
-    MOS_STATUS AttachBlock(
-        MHW_BLOCK_STATE              BlockState,
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos);
-
-    //!
-    //! \brief    INTERNAL function to insert a block into a block list.
-    //! \details  Insert a block into a block list at a given position (head, tail, insert after block)
-    //!           Ensures that the list and the block position are both valid.
-    //!           Does not check if the block is still attached to another list.
-    //!           IMPORTANT: Block must be detached, at the risk of corrupting other block lists.
-    //!                      This function does not track state heap usage
-    //! \param    [in] pList
-    //!           Pointer to memory block list structure
-    //! \param    [in] BlockState
-    //!           New block state, defines the state of the new block,
-    //!           must match the state associated with the list and reference block
-    //! \param    [in] pBlock
-    //!           Pointer to memory block to be inserted
-    //! \param    [in] pBlockPos
-    //!           Pointer to memory block after which the block is to be inserted (inserted AFTER pBlockPos)
-    //!           If set to MHW_BLOCK_POSITION_HEAD, inserts block at the head of the list.
-    //!           If set to MHW_BLOCK_POSITION_TAIL, inserts block at the tail of the list.
-    //! \return   MOS_STATUS
-    //!           Returns error code
-    //!
-    MOS_STATUS AttachBlockInternal(
-        PMHW_BLOCK_LIST              pList,
-        MHW_BLOCK_STATE              BlockState,
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos);
-
-    //!
-    //! \brief    Removes a block from a memory block list
-    //! \details  Removes a block from a memory block list from a given 
-    //! \param    [in] BlockState
-    //!           Block state defines from which list the block is to be removed.
-    //! \param    [in] pBlockPos
-    //!           Defines the object in list to be detached.
-    //!           If set to MHW_BLOCK_POSITION_HEAD, detaches the first block in the list.
-    //!           If set to MHW_BLOCK_POSITION_TAIL, detaches the last block in the list.
-    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
-    //!           Returns a pointer to the block detached, nullptr if the list is empty or invalid.
-    //!
-    PMHW_STATE_HEAP_MEMORY_BLOCK DetachBlock(
-        MHW_BLOCK_STATE              BlockState,
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos);
-
-    //!
-    //! \brief    INTERNAL function to remove a block from a block list.
-    //! \details  Removes a block from a list provided. The caller may specify the block
-    //!           to remove, or request the head or tail of the list.
-    //!           Ensures that the list and the block position are both valid.
-    //!           Does not check if the block is still attached to another list.
-    //!           IMPORTANT: Block must be detached, at the risk of corrupting other block lists.
-    //!                      This function does not track state heap usage
-    //! \param    [in] pList
-    //!           Pointer to memory block list structure
-    //! \param    [in] pBlock
-    //!           Pointer to memory block to be inserted
-    //! \return   PMHW_STATE_HEAP_MEMORY_BLOCK
-    //!           Returns block, nullptr if failure or no block available
-    //!
-    PMHW_STATE_HEAP_MEMORY_BLOCK DetachBlockInternal(
-        PMHW_BLOCK_LIST              pList,
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock);
-
-    //!
-    //! \brief    Interface to move block from one list to another
-    //! \details  Moves a block from a list into another
-    //!           Ensures that the list and the block position are both valid.
-    //!           Does not check if the block is still attached to another list.
-    //!           IMPORTANT: Block must be detached, at the risk of corrupting other block lists.
-    //!                      This function does not track state heap usage
-    //! \param    [in] pSrcList
-    //!           Pointer to source list
-    //! \param    [in] pDstList
-    //!           Pointer to destination list
-    //! \param    [in] pBlock
-    //!           Pointer to memory block to be moved
-    //! \param    [in] pBlockPos
-    //!           Pointer to memory block after which the block is to be inserted (inserted AFTER pBlockPos)
-    //!           If set to MHW_BLOCK_POSITION_HEAD, inserts block at the head of the list.
-    //!           If set to MHW_BLOCK_POSITION_TAIL, inserts block at the tail of the list.
-    //! \return   MOS_STATUS
-    //!           Returns error code
-    //!
-    MOS_STATUS MoveBlock(
-        PMHW_BLOCK_LIST              pSrcList,      // Source list
-        PMHW_BLOCK_LIST              pDstList,      // Destination list
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,        // Block to be moved (or HEAD/TAIL of source list)
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlockPos);    // Position to insert (or HEAD/TAIL of target list)
-
-    //!
-    //! \brief    Returns memory block object to pool
-    //! \details  Returns memory block object to pool
-    //! \param    [in] pBlock
-    //!           Pointer to memory block to be returned back to pool
-    //! \return   N/A
-    //!
-    void ReturnBlockToPool(PMHW_STATE_HEAP_MEMORY_BLOCK pBlock);
-
-    //!
-    //! \brief    Consolidate free memory
-    //! \details  Consolidate free memory blocks adjacent to a given free block (within the same state heap).
-    //! \param    [in] pBlock
-    //!           Pointer to free memory block
-    //! \return    N/A
-    //!
-    void ConsolidateBlock(PMHW_STATE_HEAP_MEMORY_BLOCK pBlock);
-
-    //!
-    //! \brief    INTERNAL: Move block from free to allocated list
-    //! \details  Move block from free to allocated list, setting up pointer/offset to data
-    //! \param    [in] pBlock
-    //!           Pointer to free memory block
-    //! \param    uint32_t dwAlignment
-    //!           [in] Data alignment, assured to be power of 2 by caller
-    //! \return   MOS_STATUS
-    //!           Returns the status of the operation
-    //!
-    MOS_STATUS AllocateBlockInternal(
-        PMHW_STATE_HEAP_MEMORY_BLOCK pBlock,
-        uint32_t                     dwAlignment);
-
-    //!
-    //! \brief    Split block internal
-    //! \details  Split block internal
-    //! \param    [in] pBlock
-    //!           Pointer to block to be splitted
-    //! \param    [in] dwSplitSize
-    //!           Size of the block to be splitted 
-    //! \param    [in] dwAlignment
-    //!           Data alignment, assured to be power of 2 by caller
-    //! \param    [in] bBackward
-    //!           if true, use higher part of the block
-    //! \return   MOS_STATUS
-    //!           Returns the status of the operation
-    //!
-    MOS_STATUS SplitBlockInternal(
-        PMHW_STATE_HEAP_MEMORY_BLOCK    pBlock,
-        uint32_t                        dwSplitSize,
-        uint32_t                        dwAlignment,
-        bool                            bBackward);
-
-    //!
-    //! \brief    Merge blocks
-    //! \details  Merge blocks
-    //! \param    [in]  pBlockL
-    //!           Pointer to block in lower memory
-    //! \param    [in]  pBlockH
-    //!           Pointer to block in higher memory
-    //! \param    [in] dwAlignment
-    //!           Data alignment, assured to be power of 2 by caller
-    //! \param    [in] bBackward
-    //!           if True, pBlcokL is merged into pBlockH
-    //!           if False, pBlockH is merged into pBlockL
-    //! \return   MOS_STATUS
-    //!           Returns the status of the operation
-    //!
-    MOS_STATUS MergeBlocksInternal(
-        PMHW_STATE_HEAP_MEMORY_BLOCK    pBlockL,
-        PMHW_STATE_HEAP_MEMORY_BLOCK    pBlockH,
-        uint32_t                        dwAlignment,
-        bool                            bBackward);
-
-    //!
-    //! \brief    ResizeBlock
-    //! \details  ResizeBlock
-    //! \param    [in] pBlock
-    //!           Pointer to block to be resized
-    //! \param    [in]   dwNewSize
-    //!           new size of block
-    //! \param    [in] dwAlignment
-    //!           Data alignment, assured to be power of 2 by caller
-    //! \param    [in] bBackward
-    //!           if True,  allow block to grow forward/backwards (moving its start offset)
-    //!           if False, Always grow/shrink forward;
-    //! \return   MOS_STATUS
-    //!           Returns the status of the operation
-    //!
-    MOS_STATUS ResizeBlock(
-        PMHW_STATE_HEAP_MEMORY_BLOCK    pBlock,
-        uint32_t                        dwNewSize,
-        uint32_t                        dwAlignment,
-        bool                            bBackward);
-};
-
-#endif // __MHW_BLOCK_MANAGER_H__
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_blt.cpp 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_blt.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_blt.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_blt.cpp	1970-01-01 00:00:00.000000000 +0000
@@ -1,275 +0,0 @@
-/*
-* Copyright (c) 2020, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     mhw_blt.cpp
-//! \brief    MHW interface for constructing commands for the BLT
-//!
-#include "mhw_blt.h"
-
-mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::XY_BLOCK_COPY_BLT_CMD()
-{
-    DW0.Value                                        = 0x5040000a;
-    //DW0.DwordLength                                  = GetOpLength(dwSize);
-    //DW0.ColorDepth                                   = COLOR_DEPTH_8BITCOLOR;
-    //DW0.InstructionTargetOpcode                      = INSTRUCTION_TARGETOPCODE_INSTRUCTIONTARGETXYBLOCKCOPYBLT;
-    //DW0.Client                                       = CLIENT_2DPROCESSOR;
-
-    DW1.Value                                        = 0x00000000;
-    //DW1.DestinationTiling                            = DESTINATION_TILING_LINEAR;
-
-    DW2.Value                                        = 0x00000000;
-
-    DW3.Value                                        = 0x00000000;
-
-    DW4_5.Value[0] = DW4_5.Value[1]                  = 0x00000000;
-
-    DW6.Value                                        = 0x00000000;
-
-    DW7.Value                                        = 0x00000000;
-
-    DW8.Value                                        = 0x00000000;
-    //DW8.SourceTiling                                 = SOURCE_TILING_LINEAR;
-
-    DW9_10.Value[0] = DW9_10.Value[1]                = 0x00000000;
-
-    DW11.Value                                       = 0x00000000;
-}
-
-mhw_blt_state::XY_FAST_COPY_BLT_CMD::XY_FAST_COPY_BLT_CMD()
-{
-    DW0.Value                                        = 0x50800008;
-    //DW0.DwordLength                                  = GetOpLength(dwSize);
-    //DW0.DestinationTilingMethod                      = DESTINATION_TILING_METHOD_LINEAR_TILINGDISABLED;
-    //DW0.SourceTilingMethod                           = SOURCE_TILING_METHOD_LINEAR_TILINGDISABLED;
-    //DW0.InstructionTargetOpcode                      = INSTRUCTION_TARGETOPCODE_UNNAMED66;
-    //DW0.Client                                       = CLIENT_2DPROCESSOR;
-
-    DW1.Value                                        = 0x00000000;
-    //DW1.ColorDepth                                   = COLOR_DEPTH_8BITCOLOR;
-    //DW1.TileYTypeForDestination                      = 0;
-    //DW1.TileYTypeForSource                           = 0;
-
-    DW2.Value                                        = 0x00000000;
-
-    DW3.Value                                        = 0x00000000;
-
-    DW4_5.Value[0] = DW4_5.Value[1]                  = 0x00000000;
-
-    DW6.Value                                        = 0x00000000;
-
-    DW7.Value                                        = 0x00000000;
-
-    DW8_9.Value[0] = DW8_9.Value[1]                  = 0x00000000;
-
-}
-
-
-mhw_blt_state::BCS_SWCTRL_CMD::BCS_SWCTRL_CMD()
-{
-    DW0.Value                                        = 0;
-    DW0.TileYSource                                  = 0x0;
-    DW0.TileYDestination                             = 0x0;
-    DW0.NotInvalidateBlitterCacheonBCSFlush          = 0x0;
-    DW0.ShrinkBlitterCache                           = 0x0;
-    DW0.TileYSourceMask                              = 0x1;
-    DW0.TileYDestinationMask                         = 0x1;
-    DW0.Mask                                         = 0x0;
-}
-
-MhwBltInterface::MhwBltInterface(PMOS_INTERFACE pOsInterface)
-{
-    MHW_FUNCTION_ENTER;
-
-    pfnAddResourceToCmd = nullptr;
-
-    if (pOsInterface == nullptr)
-    {
-        MHW_ASSERTMESSAGE("Invalid OsInterface pointers provided");
-        return;
-    }
-
-    m_osInterface       = pOsInterface;
-    if (m_osInterface->bUsesGfxAddress)
-    {
-        pfnAddResourceToCmd = Mhw_AddResourceToCmd_GfxAddress;
-    }
-    else  //PatchList
-    {
-        pfnAddResourceToCmd = Mhw_AddResourceToCmd_PatchList;
-    }
-}
-
-MOS_STATUS MhwBltInterface::AddFastCopyBlt(
-    PMOS_COMMAND_BUFFER      pCmdBuffer,
-    PMHW_FAST_COPY_BLT_PARAM pFastCopyBltParam,
-    uint32_t                    srcOffset,
-    uint32_t                    dstOffset)
-{
-    MHW_FUNCTION_ENTER;
-
-    MHW_RESOURCE_PARAMS ResourceParams;
-    MOS_STATUS          eStatus;
-
-    eStatus = MOS_STATUS_SUCCESS;
-
-    MHW_CHK_NULL_RETURN(pFastCopyBltParam);
-    MHW_CHK_NULL_RETURN(pFastCopyBltParam->pDstOsResource);
-    MHW_CHK_NULL_RETURN(pFastCopyBltParam->pSrcOsResource);
-    MHW_CHK_NULL_RETURN(pFastCopyBltParam->pDstOsResource->pGmmResInfo);
-    MHW_CHK_NULL_RETURN(pFastCopyBltParam->pSrcOsResource->pGmmResInfo);
-
-    mhw_blt_state::XY_FAST_COPY_BLT_CMD cmd;
-
-    BLT_TILE_TYPE dstTiledMode = static_cast<BLT_TILE_TYPE>(pFastCopyBltParam->pDstOsResource->pGmmResInfo->GetTileType());
-    BLT_TILE_TYPE srcTiledMode = static_cast<BLT_TILE_TYPE>(pFastCopyBltParam->pSrcOsResource->pGmmResInfo->GetTileType());
-
-    cmd.DW0.SourceTilingMethod            = GetFastTilingMode(srcTiledMode);
-    cmd.DW0.DestinationTilingMethod       = GetFastTilingMode(dstTiledMode);
-    cmd.DW1.TileYTypeForSource            = (srcTiledMode == BLT_NOT_TILED) ? 0 : 1;
-    cmd.DW1.TileYTypeForDestination       = (dstTiledMode == BLT_NOT_TILED) ? 0 : 1;
-    cmd.DW1.ColorDepth                    = pFastCopyBltParam->dwColorDepth;
-    cmd.DW1.DestinationPitch              = pFastCopyBltParam->dwDstPitch;
-    cmd.DW2.DestinationX1CoordinateLeft   = pFastCopyBltParam->dwDstLeft;
-    cmd.DW2.DestinationY1CoordinateTop    = pFastCopyBltParam->dwDstTop;
-    cmd.DW3.DestinationX2CoordinateRight  = pFastCopyBltParam->dwDstRight;
-    cmd.DW3.DestinationY2CoordinateBottom = pFastCopyBltParam->dwDstBottom;
-    cmd.DW6.SourceX1CoordinateLeft        = pFastCopyBltParam->dwSrcLeft;
-    cmd.DW6.SourceY1CoordinateTop         = pFastCopyBltParam->dwSrcTop;
-    cmd.DW7.SourcePitch                   = pFastCopyBltParam->dwSrcPitch;
-
-    // add source address
-    MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
-    ResourceParams.dwLsbNum        = MHW_BLT_ENGINE_STATE_BASE_ADDRESS_SHIFT;
-    ResourceParams.dwOffset        = srcOffset;
-    ResourceParams.presResource    = pFastCopyBltParam->pSrcOsResource;
-    ResourceParams.pdwCmd          = &(cmd.DW8_9.Value[0]);
-    ResourceParams.dwLocationInCmd = 8;
-    ResourceParams.bIsWritable     = true;
-
-    MHW_CHK_STATUS(pfnAddResourceToCmd(
-        m_osInterface,
-        pCmdBuffer,
-        &ResourceParams));
-
-    // add destination address
-    MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
-    ResourceParams.dwLsbNum        = MHW_BLT_ENGINE_STATE_BASE_ADDRESS_SHIFT;
-    ResourceParams.dwOffset        = dstOffset;
-    ResourceParams.presResource    = pFastCopyBltParam->pDstOsResource;
-    ResourceParams.pdwCmd          = &(cmd.DW4_5.Value[0]);
-    ResourceParams.dwLocationInCmd = 4;
-    ResourceParams.bIsWritable     = true;
-
-    MHW_CHK_STATUS(pfnAddResourceToCmd(
-        m_osInterface,
-        pCmdBuffer,
-        &ResourceParams));
-
-    Mos_AddCommand(pCmdBuffer, &cmd, cmd.byteSize);
-
-finish:
-    return eStatus;
-}
-
-MOS_STATUS MhwBltInterface::AddBlockCopyBlt(
-    PMOS_COMMAND_BUFFER      pCmdBuffer,
-    PMHW_FAST_COPY_BLT_PARAM pFastCopyBltParam, 
-    uint32_t                 srcOffset,
-    uint32_t                 dstOffset)
-{
-    MHW_FUNCTION_ENTER;
-
-    MHW_RESOURCE_PARAMS ResourceParams;
-    MOS_STATUS          eStatus;
-
-    eStatus = MOS_STATUS_SUCCESS;
-
-    mhw_blt_state::XY_BLOCK_COPY_BLT_CMD cmd;
-
-    cmd.DW0.ColorDepth = pFastCopyBltParam->dwColorDepth;
-    cmd.DW1.DestinationPitch = pFastCopyBltParam->dwDstPitch -1;
-    cmd.DW1.DestinationMocsValue =
-        m_osInterface->pfnGetGmmClientContext(m_osInterface)->CachePolicyGetMemoryObject(nullptr, GMM_RESOURCE_USAGE_BLT_DESTINATION).DwordValue;
-
-    cmd.DW1.DestinationTiling = (pFastCopyBltParam->pDstOsResource->TileType == MOS_TILE_LINEAR) ? 0:1; 
-    cmd.DW8.SourceTiling = (pFastCopyBltParam->pSrcOsResource->TileType == MOS_TILE_LINEAR) ? 0:1;
-    cmd.DW8.SourceMocs =
-        m_osInterface->pfnGetGmmClientContext(m_osInterface)->CachePolicyGetMemoryObject(nullptr, GMM_RESOURCE_USAGE_BLT_SOURCE).DwordValue;
-
-    cmd.DW2.DestinationX1CoordinateLeft = 0;
-    cmd.DW2.DestinationY1CoordinateTop = 0;
-    cmd.DW3.DestinationX2CoordinateRight = pFastCopyBltParam->dwDstRight;
-    cmd.DW3.DestinationY2CoordinateBottom = pFastCopyBltParam->dwDstBottom;
-    cmd.DW7.SourceX1CoordinateLeft = pFastCopyBltParam->dwSrcLeft;
-    cmd.DW7.SourceY1CoordinateTop = pFastCopyBltParam->dwSrcTop;
-    cmd.DW8.SourcePitch = pFastCopyBltParam->dwSrcPitch -1;
-
-    // add source address
-    MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
-    ResourceParams.dwLsbNum        = 12;
-    ResourceParams.dwOffset        = srcOffset;
-    ResourceParams.presResource    = pFastCopyBltParam->pSrcOsResource;
-    ResourceParams.pdwCmd          = &(cmd.DW9_10.Value[0]);
-    ResourceParams.dwLocationInCmd = 9;
-    ResourceParams.bIsWritable     = true;
-
-    MHW_CHK_STATUS(pfnAddResourceToCmd(
-        m_osInterface,
-        pCmdBuffer,
-        &ResourceParams));
-
-    // add destination address
-    MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
-    ResourceParams.dwLsbNum        = 12;
-    ResourceParams.dwOffset        = dstOffset;
-    ResourceParams.presResource    = pFastCopyBltParam->pDstOsResource;
-    ResourceParams.pdwCmd          = &(cmd.DW4_5.Value[0]);
-    ResourceParams.dwLocationInCmd = 4;
-    ResourceParams.bIsWritable     = true;
-
-    MHW_CHK_STATUS(pfnAddResourceToCmd(
-        m_osInterface,
-        pCmdBuffer,
-        &ResourceParams));
-
-    Mos_AddCommand(pCmdBuffer, &cmd, cmd.byteSize);
-
-finish:
-    return eStatus;
-}
-
-uint32_t MhwBltInterface::GetFastTilingMode(BLT_TILE_TYPE TileType)
-{
-   switch(TileType)
-   {
-      case BLT_NOT_TILED:
-          return mhw_blt_state::XY_FAST_COPY_BLT_CMD::DESTINATION_TILING_METHOD_LINEAR_TILINGDISABLED;
-      case BLT_TILED_Y:
-      case BLT_TILED_4:
-          return mhw_blt_state::XY_FAST_COPY_BLT_CMD::DESTINATION_TILING_METHOD_TILE_Y;
-      case BLT_TILED_64:
-          return mhw_blt_state::XY_FAST_COPY_BLT_CMD::DESTINATION_TILING_METHOD_64KBTILING;
-      default:
-         MHW_ASSERTMESSAGE("BLT: Can't support GMM TileType %d.", TileType);
-   }
-   return mhw_blt_state::XY_FAST_COPY_BLT_CMD::DESTINATION_TILING_METHOD_LINEAR_TILINGDISABLED;
-}
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_blt.h 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_blt.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_blt.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_blt.h	1970-01-01 00:00:00.000000000 +0000
@@ -1,556 +0,0 @@
-/*
-* Copyright (c) 2020, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file     mhw_blt.h
-//! \brief    MHW interface for constructing commands for the BLT
-//!
-#ifndef __MHW_BLT_H__
-#define __MHW_BLT_H__
-
-#include "mos_os.h"
-#include "mhw_utilities.h"
-
-//!
-//! \brief  Fast copy blt parameters
-//!
-typedef struct _MHW_FAST_COPY_BLT_PARAM
-{
-    uint32_t        dwColorDepth;
-    uint32_t        dwSrcPitch;
-    uint32_t        dwDstPitch;
-    uint32_t        dwSrcTop;
-    uint32_t        dwSrcLeft;
-    uint32_t        dwDstTop;
-    uint32_t        dwDstBottom;
-    uint32_t        dwDstLeft;
-    uint32_t        dwDstRight;
-    PMOS_RESOURCE   pSrcOsResource;
-    PMOS_RESOURCE   pDstOsResource;
-}MHW_FAST_COPY_BLT_PARAM, *PMHW_FAST_COPY_BLT_PARAM;
-
-typedef enum BLT_TILE_TYPE_ENUM
-{
-   BLT_TILED_X,
-   BLT_TILED_Y,
-   BLT_TILED_W,
-   BLT_NOT_TILED,
-   BLT_TILED_4,
-   BLT_TILED_64
-}BLT_TILE_TYPE;
-
-typedef enum _MHW_BLT_ENGINE_ADDRESS_SHIFT
-{
-    MHW_BLT_ENGINE_STATE_BASE_ADDRESS_SHIFT = 6
-} MHW_BLT_ENGINE_ADDRESS_SHIFT;
-
-class mhw_blt_state
-{
-public:
-     // Internal Macros
-    #define __CODEGEN_MAX(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
-    #define __CODEGEN_BITFIELD(l, h) (h) - (l) + 1
-    #define __CODEGEN_OP_LENGTH_BIAS 2
-    #define __CODEGEN_OP_LENGTH(x) (uint32_t)((__CODEGEN_MAX(x, __CODEGEN_OP_LENGTH_BIAS)) - __CODEGEN_OP_LENGTH_BIAS)
-
-    static uint32_t GetOpLength(uint32_t uiLength) { return __CODEGEN_OP_LENGTH(uiLength); }
-
-    //!
-    //! \brief XY_BLOCK_COPY_BLT
-    //! \details
-    //!     XY_BLOCK_COPY_BLT instruction performs a color source copy where the
-    //!     only operands involved are a color source and destination of the same
-    //!     bit width. The source and destination surfaces CAN overlap, the hardware
-    //!     handles this internally. This new blit command will happen in large
-    //!     numbers, consecutively, possibly an entire batch will comprise only new
-    //!     blit commands. Legacy commands and new blit command will not be
-    //!     interspersed. If they are, they will be separated by implied HW flush:
-    //!     Whenever there is a transition between this new Fast Blit command and
-    //!     the Legacy Blit commands (2D BLT instructions other than
-    //!     XY_BLOCK_COPY_BLT, XY_FAST_COPY_BLT, XY_FAST_COLOR_BLT), the HW will
-    //!     impose an automatic flush BEFORE the execution (at the beginning) of the
-    //!     next blitter command. The starting pixel of the blit operation for both
-    //!     source and destination should be on a pixel boundary.
-    //!     Note that when two sequential block copy blits have different source
-    //!     surfaces, but their destinations refer to the same destination surfaces
-    //!     and therefore destinations overlap it is imperative that a Flush be
-    //!     inserted between the two blits.
-    //!     
-    struct XY_BLOCK_COPY_BLT_CMD
-    {
-        union
-        {
-            struct
-            {
-                uint32_t                 DwordLength                                      : __CODEGEN_BITFIELD( 0,  7)    ; //!< DWORD_LENGTH
-                uint32_t                 Reserved8                                        : __CODEGEN_BITFIELD( 8, 18)    ; //!< Reserved
-                uint32_t                 ColorDepth                                       : __CODEGEN_BITFIELD(19, 21)    ; //!< COLOR_DEPTH
-                uint32_t                 InstructionTargetOpcode                          : __CODEGEN_BITFIELD(22, 28)    ; //!< INSTRUCTION_TARGETOPCODE
-                uint32_t                 Client                                           : __CODEGEN_BITFIELD(29, 31)    ; //!< CLIENT
-            };
-            uint32_t                     Value;
-        } DW0;
-        union
-        {
-            struct
-            {
-                uint32_t                 DestinationPitch                                 : __CODEGEN_BITFIELD( 0, 17)    ; //!< Destination Pitch
-                uint32_t                 Reserved50                                       : __CODEGEN_BITFIELD(18, 20)    ; //!< Reserved
-                uint32_t                 DestinationMocsValue                             : __CODEGEN_BITFIELD(21, 27)    ; //!< Destination MOCS value
-                uint32_t                 Reserved60                                       : __CODEGEN_BITFIELD(28, 29)    ; //!< Reserved
-                uint32_t                 DestinationTiling                                : __CODEGEN_BITFIELD(30, 31)    ; //!< DESTINATION_TILING
-            };
-            uint32_t                     Value;
-        } DW1;
-        union
-        {
-            struct
-            {
-                uint32_t                 DestinationX1CoordinateLeft                      : __CODEGEN_BITFIELD( 0, 15)    ; //!< Destination X1 Coordinate (Left)
-                uint32_t                 DestinationY1CoordinateTop                       : __CODEGEN_BITFIELD(16, 31)    ; //!< Destination Y1 Coordinate (Top)
-            };
-            uint32_t                     Value;
-        } DW2;
-        union
-        {
-            struct
-            {
-                uint32_t                 DestinationX2CoordinateRight                     : __CODEGEN_BITFIELD( 0, 15)    ; //!< Destination X2 Coordinate (Right)
-                uint32_t                 DestinationY2CoordinateBottom                    : __CODEGEN_BITFIELD(16, 31)    ; //!< Destination Y2 Coordinate (Bottom)
-            };
-            uint32_t                     Value;
-        } DW3;
-        union
-        {
-            struct
-            {
-                uint64_t                 DestinationBaseAddress                                                           ; //!< Destination Base Address
-            };
-            uint32_t                     Value[2];
-        } DW4_5;
-        union
-        {
-            struct
-            {
-                uint32_t                 DestinationXOffset                               : __CODEGEN_BITFIELD( 0, 13)    ; //!< Destination X offset
-                uint32_t                 Reserved206                                      : __CODEGEN_BITFIELD(14, 15)    ; //!< Reserved
-                uint32_t                 DestinationYOffset                               : __CODEGEN_BITFIELD(16, 29)    ; //!< Destination Y offset
-                uint32_t                 Reserved222                                      : __CODEGEN_BITFIELD(30, 31)    ; //!< Reserved
-            };
-            uint32_t                     Value;
-        } DW6;
-        union
-        {
-            struct
-            {
-                uint32_t                 SourceX1CoordinateLeft                           : __CODEGEN_BITFIELD( 0, 15)    ; //!< Source X1 Coordinate (Left)
-                uint32_t                 SourceY1CoordinateTop                            : __CODEGEN_BITFIELD(16, 31)    ; //!< Source Y1 Coordinate (Top)
-            };
-            uint32_t                     Value;
-        } DW7;
-        union
-        {
-            struct
-            {
-                uint32_t                 SourcePitch                                      : __CODEGEN_BITFIELD( 0, 17)    ; //!< Source Pitch
-                uint32_t                 Reserved274                                      : __CODEGEN_BITFIELD(18, 20)    ; //!< Reserved
-                uint32_t                 SourceMocs                                       : __CODEGEN_BITFIELD(21, 27)    ; //!< Source MOCS
-                uint32_t                 Reserved284                                      : __CODEGEN_BITFIELD(28, 29)    ; //!< Reserved
-                uint32_t                 SourceTiling                                     : __CODEGEN_BITFIELD(30, 31)    ; //!< SOURCE_TILING
-            };
-            uint32_t                     Value;
-        } DW8;
-        union
-        {
-            struct
-            {
-                uint64_t                 SourceBaseAddress                                                                ; //!< Source Base Address
-            };
-            uint32_t                     Value[2];
-        } DW9_10;
-        union
-        {
-            struct
-            {
-                uint32_t                 SourceXOffset                                    : __CODEGEN_BITFIELD( 0, 13)    ; //!< Source X offset
-                uint32_t                 Reserved366                                      : __CODEGEN_BITFIELD(14, 15)    ; //!< Reserved
-                uint32_t                 SourceYOffset                                    : __CODEGEN_BITFIELD(16, 29)    ; //!< Source Y offset
-                uint32_t                 Reserved382                                      : __CODEGEN_BITFIELD(30, 31)    ; //!< Reserved
-            };
-            uint32_t                     Value;
-        } DW11;
-
-        //! \name Local enumerations
-
-        //! \brief COLOR_DEPTH
-        //! \details
-        //!     This field actually programs bits per pixel value for each pixel of
-        //!     the surface. Reprogramming of these bits require explicit flushing of
-        //!     Copy Engine.
-        enum COLOR_DEPTH
-        {
-            COLOR_DEPTH_8BITCOLOR                                            = 0, //!< No additional details
-            COLOR_DEPTH_16BITCOLOR                                           = 1, //!< No additional details
-            COLOR_DEPTH_32BITCOLOR                                           = 2, //!< No additional details
-            COLOR_DEPTH_64BITCOLOR                                           = 3, //!< No additional details
-            COLOR_DEPTH_96BITCOLOR_ONLYLINEARCASEISSUPPORTED                 = 4, //!< No additional details
-            COLOR_DEPTH_128BITCOLOR                                          = 5, //!< No additional details
-        };
-
-        enum INSTRUCTION_TARGETOPCODE
-        {
-            INSTRUCTION_TARGETOPCODE_INSTRUCTIONTARGETXYBLOCKCOPYBLT         = 65, //!< No additional details
-        };
-
-        enum CLIENT
-        {
-            CLIENT_2DPROCESSOR                                               = 2, //!< No additional details
-        };
-
-        //! \brief DESTINATION_TILING
-        //! \details
-        //!     These bits indicate destination tiling method.
-        enum DESTINATION_TILING
-        {
-            DESTINATION_TILING_LINEAR                                        = 0, //!< Linear mode (no tiling)
-            DESTINATION_TILING_YMAJOR                                        = 1, //!< Y major tiling
-        };
-
-        //! \brief SOURCE_TILING
-        //! \details
-        //!     These bits indicate source tiling method.
-        enum SOURCE_TILING
-        {
-            SOURCE_TILING_LINEAR                                             = 0, //!< Linear Tiling (tiking disabled)
-            SOURCE_TILING_YMAJOR                                             = 1, //!< Y major tiling
-        };
-
-        //! \name Initializations
-
-        //! \brief Explicit member initialization function
-        XY_BLOCK_COPY_BLT_CMD();
-
-        static const size_t dwSize = 12;
-        static const size_t byteSize = 48;
-    };
-
-    //!
-    //! \brief XY_FAST_COPY_BLT
-    //! \details
-    //!     This BLT instruction performs a color source copy where the only
-    //!     operands involved are a color source and destination of the same bit
-    //!     width. The source and destination surfaces CANNOT overlap. The hardware
-    //!     assumes this whenever this Fast_Copy command is given to it. For
-    //!     overlapping Blits, use the traditional XY_SRC_COPY_BLT command (for
-    //!     overlap determination, read the description given in the XY_SRC_COPY_BLT
-    //!     command). Note that this command does not support Clipping operations.
-    //!     This new blit command will happen in large numbers, consecutively,
-    //!     possibly an entire batch will comprise only new blit commands Legacy
-    //!     commands and new blit command will not be interspersed. If they are,
-    //!     they will be separated by implied HW flush: Whenever there is a
-    //!     transition between this new Fast Blit command and the Legacy Blit
-    //!     commands (2D BLT instructions other than XY_BLOCK_COPY_BLT,
-    //!     XY_FAST_COPY_BLT and XY_FAST_COLOR_BLT), the HW will impose an automatic
-    //!     flush BEFORE the execution (at the beginning) of the next blitter
-    //!     command. New blit command can use any combination of memory surface type
-    //!     - linear, tiledX, tiledY, and the tiling information is conveyed as part
-    //!     of the new Fast Copy command. The Fast Copy Blit supports the new 64KB
-    //!     Tiling defined for SKL.The starting pixel of Fast Copy blit for both
-    //!     source and destination should be on an OWord boundary.
-    //!     Note that when two sequential fast copy blits have different source
-    //!     surfaces, but their destinations refer to the same destination surfaces
-    //!     and therefore destinations overlap it is imperative that a Flush be
-    //!     inserted between the two blits.
-    //!
-
-    struct XY_FAST_COPY_BLT_CMD
-    {
-        union
-        {
-            struct
-            {
-                uint32_t                 DwordLength                                      : __CODEGEN_BITFIELD( 0,  7)    ; //!< DWORD_LENGTH
-                uint32_t                 Reserved8                                        : __CODEGEN_BITFIELD( 8, 12)    ; //!< Reserved
-                uint32_t                 DestinationTilingMethod                          : __CODEGEN_BITFIELD(13, 14)    ; //!< DESTINATION_TILING_METHOD
-                uint32_t                 Reserved15                                       : __CODEGEN_BITFIELD(15, 19)    ; //!< Reserved
-                uint32_t                 SourceTilingMethod                               : __CODEGEN_BITFIELD(20, 21)    ; //!< SOURCE_TILING_METHOD
-                uint32_t                 InstructionTargetOpcode                          : __CODEGEN_BITFIELD(22, 28)    ; //!< INSTRUCTION_TARGETOPCODE
-                uint32_t                 Client                                           : __CODEGEN_BITFIELD(29, 31)    ; //!< CLIENT
-            };
-            uint32_t                     Value;
-        } DW0;
-        union
-        {
-            struct
-            {
-                uint32_t                 DestinationPitch                                 : __CODEGEN_BITFIELD( 0, 15)    ; //!< Destination Pitch
-                uint32_t                 Reserved48                                       : __CODEGEN_BITFIELD(16, 23)    ; //!< Reserved
-                uint32_t                 ColorDepth                                       : __CODEGEN_BITFIELD(24, 26)    ; //!< COLOR_DEPTH
-                uint32_t                 Reserved59                                       : __CODEGEN_BITFIELD(27, 29)    ; //!< Reserved
-                uint32_t                 TileYTypeForDestination                          : __CODEGEN_BITFIELD(30, 30)    ; //!< TILE_Y_TYPE_FOR_DESTINATION
-                uint32_t                 TileYTypeForSource                               : __CODEGEN_BITFIELD(31, 31)    ; //!< TILE_Y_TYPE_FOR_SOURCE
-            };
-            uint32_t                     Value;
-        } DW1;
-        union
-        {
-            struct
-            {
-                uint32_t                 DestinationX1CoordinateLeft                      : __CODEGEN_BITFIELD( 0, 15)    ; //!< Destination X1 Coordinate (Left)
-                uint32_t                 DestinationY1CoordinateTop                       : __CODEGEN_BITFIELD(16, 31)    ; //!< Destination Y1 Coordinate (Top)
-            };
-            uint32_t                     Value;
-        } DW2;
-        union
-        {
-            struct
-            {
-                uint32_t                 DestinationX2CoordinateRight                     : __CODEGEN_BITFIELD( 0, 15)    ; //!< Destination X2 Coordinate (Right)
-                uint32_t                 DestinationY2CoordinateBottom                    : __CODEGEN_BITFIELD(16, 31)    ; //!< Destination Y2 Coordinate (Bottom)
-            };
-            uint32_t                     Value;
-        } DW3;
-        union
-        {
-            struct
-            {
-                uint64_t                 DestinationBaseAddress                                                           ; //!< Destination Base Address
-            };
-            uint32_t                     Value[2];
-        } DW4_5;
-        union
-        {
-            struct
-            {
-                uint32_t                 SourceX1CoordinateLeft                           : __CODEGEN_BITFIELD( 0, 15)    ; //!< Source X1 Coordinate (Left)
-                uint32_t                 SourceY1CoordinateTop                            : __CODEGEN_BITFIELD(16, 31)    ; //!< Source Y1 Coordinate (Top)
-            };
-            uint32_t                     Value;
-        } DW6;
-        union
-        {
-            struct
-            {
-                uint32_t                 SourcePitch                                      : __CODEGEN_BITFIELD( 0, 15)    ; //!< Source Pitch
-                uint32_t                 Reserved240                                      : __CODEGEN_BITFIELD(16, 31)    ; //!< Reserved
-            };
-            uint32_t                     Value;
-        } DW7;
-        union
-        {
-            struct
-            {
-                uint64_t                 SourceBaseAddress                                                                ; //!< Source Base Address
-            };
-            uint32_t                     Value[2];
-        } DW8_9;
-
-        //! \name Local enumerations
-
-        //! \brief DESTINATION_TILING_METHOD
-        //! \details
-        //!     SW is required to flush the HW before changing the polarity of these
-        //!     bits for subsequent blits.
-        enum DESTINATION_TILING_METHOD
-        {
-            DESTINATION_TILING_METHOD_LINEAR_TILINGDISABLED                  = 0, //!< No additional details
-            DESTINATION_TILING_METHOD_LEGACYTILE_X                           = 1, //!< No additional details
-            DESTINATION_TILING_METHOD_TILE_Y                                 = 2, //!< Choosing between 'Legacy Tile-Y' or the 'New 4K Tile-YF' can be done in DWord 1, Bit[30].
-            DESTINATION_TILING_METHOD_64KBTILING                             = 3, //!< No additional details
-        };
-
-        //! \brief SOURCE_TILING_METHOD
-        //! \details
-        //!     SW is required to flush the HW before changing the polarity of these
-        //!     bits for subsequent blits.
-        enum SOURCE_TILING_METHOD
-        {
-            SOURCE_TILING_METHOD_LINEAR_TILINGDISABLED                       = 0, //!< No additional details
-            SOURCE_TILING_METHOD_LEGACYTILE_X                                = 1, //!< No additional details
-            SOURCE_TILING_METHOD_TILE_Y                                      = 2, //!< Choosing between 'Legacy Tile-Y' or the 'New 4K Tile-YF' can be done in DWord 1, Bit[31].
-            SOURCE_TILING_METHOD_64KBTILING                                  = 3, //!< No additional details
-        };
-
-        enum INSTRUCTION_TARGETOPCODE
-        {
-            INSTRUCTION_TARGETOPCODE_UNNAMED66                               = 66, //!< No additional details
-        };
-
-        enum CLIENT
-        {
-            CLIENT_2DPROCESSOR                                               = 2, //!< No additional details
-        };
-
-        enum COLOR_DEPTH
-        {
-            COLOR_DEPTH_8BITCOLOR                                            = 0, //!< No additional details
-            COLOR_DEPTH_16BITCOLOR_565                                       = 1, //!< No additional details
-            COLOR_DEPTH_32BITCOLOR                                           = 3, //!< No additional details
-            COLOR_DEPTH_64BITCOLOR_FOR64KBTILING                             = 4, //!< No additional details
-            COLOR_DEPTH_128BITCOLOR_FOR64KBTILING                            = 5, //!< No additional details
-        };
-
-        //! \brief TILE_Y_TYPE_FOR_DESTINATION
-        //! \details
-        //!     Destination being Tile-Y can be selected in DWord 0, Bit[14:13].
-        enum TILE_Y_TYPE_FOR_DESTINATION
-        {
-            TILE_Y_TYPE_FOR_DESTINATION_NEW4KTILE_YF                         = 1, //!< No additional details
-        };
-
-        //! \brief TILE_Y_TYPE_FOR_SOURCE
-        //! \details
-        //!     Source being Tile-Y can be selected in DWord 0, Bit[21:20].
-        enum TILE_Y_TYPE_FOR_SOURCE
-        {
-            TILE_Y_TYPE_FOR_SOURCE_NEW4KTILE_YF                              = 1, //!< No additional details
-        };
-
-        //! \name Initializations
-
-        //! \brief Explicit member initialization function
-        XY_FAST_COPY_BLT_CMD();
-
-        static const size_t dwSize = 10;
-        static const size_t byteSize = 40;
-    };
-
-    //////////////////////////////////////////////////////////////////////////
-    /// @brief BCS_SWCTRL
-    /// @details
-    ///
-    ///
-    struct BCS_SWCTRL_CMD
-    {
-     union
-     {
-      struct
-      {
-       /// DWORD 0
-       uint32_t                 TileYSource : __CODEGEN_BITFIELD(0, 0); ///< U1
-       uint32_t                 TileYDestination : __CODEGEN_BITFIELD(1, 1); ///< U1
-       uint32_t                 NotInvalidateBlitterCacheonBCSFlush : __CODEGEN_BITFIELD(2, 2); ///< U1
-       uint32_t                 ShrinkBlitterCache : __CODEGEN_BITFIELD(3, 3); ///< U1
-       uint32_t                 Reserved_4 : __CODEGEN_BITFIELD(4, 15); ///< U12
-       uint32_t                 TileYSourceMask : __CODEGEN_BITFIELD(16, 16); ///< U1
-       uint32_t                 TileYDestinationMask : __CODEGEN_BITFIELD(17, 17); ///< U1
-       uint32_t                 Mask : __CODEGEN_BITFIELD(18, 31); ///< U16
-
-      };
-      uint32_t                     Value;
-     } DW0;
-
-     //////////////////////////////////////////////////////////////////////////
-     /// @name LOCAL ENUMERATIONS
-     /// @{
-
-     /// @brief
-     enum CONSTANTS_TYPE
-     {
-      COMMAND_LENGTH = 1, ///<
-      REGISTER_OFFSET = 0x22200, ///<
-     };
-     //! \name Initializations
-
-     //! \brief Explicit member initialization function
-     BCS_SWCTRL_CMD();
-
-     static const size_t dwSize = 1;
-     static const size_t byteSize = 4;
-    };
-};
-
-class MhwBltInterface
-{
-public:
-    MhwBltInterface(PMOS_INTERFACE pOsInterface);
-
-    virtual ~MhwBltInterface()
-    {
-        MHW_FUNCTION_ENTER;
-    }
-
-    //!
-    //! \brief    Add fast copy blt
-    //! \details  MHW function to add fast copy blt command
-    //! \param    [in] pCmdBuffer
-    //!           Pointer to Command buffer
-    //! \param    [in] pFastCopyBltParam
-    //!           Pointer to MHW_FAST_COPY_BLT_PARAM
-    //! \param    [in] srcOffset
-    //!           input surface's soruce offset
-    //! \param    [in] outOffset
-    //!           output surface's soruce offset
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddFastCopyBlt(
-        PMOS_COMMAND_BUFFER         pCmdBuffer,
-        PMHW_FAST_COPY_BLT_PARAM    pFastCopyBltParam,
-        uint32_t                    srcOffset,
-        uint32_t                    dstOffset);
-
-    //!
-    //! \brief    Add Block copy
-    //! \details  MHW function to add block copy command
-    //! \param    [in] pCmdBuffer
-    //!           Pointer to Command buffer
-    //! \param    [in] pFastCopyBltParam
-    //!           Pointer to MHW_FAST_COPY_BLT_PARAM
-    //! \param    [in] srcOffset
-    //!           input surface's soruce offset
-    //! \param    [in] outOffset
-    //!           output surface's soruce offset
-    //! \return   MOS_STATUS
-    //!           MOS_STATUS_SUCCESS if success, else fail reason
-    //!
-    virtual MOS_STATUS AddBlockCopyBlt(
-        PMOS_COMMAND_BUFFER         pCmdBuffer,
-        PMHW_FAST_COPY_BLT_PARAM    pFastCopyBltParam,
-        uint32_t                    srcOffset,
-        uint32_t                    dstOffset);
-
-    MOS_STATUS (*pfnAddResourceToCmd)(
-        PMOS_INTERFACE          pOsInterface,
-        PMOS_COMMAND_BUFFER     pCmdBuffer,
-        PMHW_RESOURCE_PARAMS    pParams);
-
-    //!
-    //! \brief    Get fastcopy tilling mode
-    //! \details  Get fastcopy tilling mode
-    //! \param    [in] TileType
-    //!           Pointer to BLT_TILE_TYPE
-    //! \return   uint32_t
-    //!           0:1:2:3
-    //!
-    virtual uint32_t GetFastTilingMode(
-        BLT_TILE_TYPE              TileType);
-
-    virtual std::shared_ptr<void> GetNewBltInterface() { return nullptr; }
-
-public:
-    PMOS_INTERFACE m_osInterface = nullptr;
-    std::shared_ptr<void>  m_bltItfNew    = nullptr;
-};
-
-typedef class MhwBltInterface *PMHW_BLT_INTERFACE;
-
-#endif  // __MHW_BLT_H__
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_blt_legacy.cpp 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_blt_legacy.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_blt_legacy.cpp	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_blt_legacy.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2020-2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     mhw_blt_legacy.cpp
+//! \brief    MHW interface for constructing commands for the BLT
+//!
+#include "mhw_blt_legacy.h"
+
+MhwBltInterface::MhwBltInterface(PMOS_INTERFACE pOsInterface)
+{
+    MHW_FUNCTION_ENTER;
+
+    pfnAddResourceToCmd = nullptr;
+
+    if (pOsInterface == nullptr)
+    {
+        MHW_ASSERTMESSAGE("Invalid OsInterface pointers provided");
+        return;
+    }
+
+    m_osInterface       = pOsInterface;
+    if (m_osInterface->bUsesGfxAddress)
+    {
+        pfnAddResourceToCmd = Mhw_AddResourceToCmd_GfxAddress;
+    }
+    else  //PatchList
+    {
+        pfnAddResourceToCmd = Mhw_AddResourceToCmd_PatchList;
+    }
+}
+
+MOS_STATUS MhwBltInterface::AddFastCopyBlt(
+    PMOS_COMMAND_BUFFER      pCmdBuffer,
+    PMHW_FAST_COPY_BLT_PARAM pFastCopyBltParam,
+    uint32_t                    srcOffset,
+    uint32_t                    dstOffset)
+{
+    MHW_FUNCTION_ENTER;
+
+    MHW_RESOURCE_PARAMS ResourceParams;
+    MOS_STATUS          eStatus;
+
+    eStatus = MOS_STATUS_SUCCESS;
+
+    MHW_CHK_NULL_RETURN(pFastCopyBltParam);
+    MHW_CHK_NULL_RETURN(pFastCopyBltParam->pDstOsResource);
+    MHW_CHK_NULL_RETURN(pFastCopyBltParam->pSrcOsResource);
+    MHW_CHK_NULL_RETURN(pFastCopyBltParam->pDstOsResource->pGmmResInfo);
+    MHW_CHK_NULL_RETURN(pFastCopyBltParam->pSrcOsResource->pGmmResInfo);
+
+    mhw_blt_state::XY_FAST_COPY_BLT_CMD cmd;
+
+    BLT_TILE_TYPE dstTiledMode = static_cast<BLT_TILE_TYPE>(pFastCopyBltParam->pDstOsResource->pGmmResInfo->GetTileType());
+    BLT_TILE_TYPE srcTiledMode = static_cast<BLT_TILE_TYPE>(pFastCopyBltParam->pSrcOsResource->pGmmResInfo->GetTileType());
+
+    cmd.DW0.SourceTilingMethod            = GetFastTilingMode(srcTiledMode);
+    cmd.DW0.DestinationTilingMethod       = GetFastTilingMode(dstTiledMode);
+    cmd.DW1.TileYTypeForSource            = (srcTiledMode == BLT_NOT_TILED) ? 0 : 1;
+    cmd.DW1.TileYTypeForDestination       = (dstTiledMode == BLT_NOT_TILED) ? 0 : 1;
+    cmd.DW1.ColorDepth                    = pFastCopyBltParam->dwColorDepth;
+    cmd.DW1.DestinationPitch              = pFastCopyBltParam->dwDstPitch;
+    cmd.DW2.DestinationX1CoordinateLeft   = pFastCopyBltParam->dwDstLeft;
+    cmd.DW2.DestinationY1CoordinateTop    = pFastCopyBltParam->dwDstTop;
+    cmd.DW3.DestinationX2CoordinateRight  = pFastCopyBltParam->dwDstRight;
+    cmd.DW3.DestinationY2CoordinateBottom = pFastCopyBltParam->dwDstBottom;
+    cmd.DW6.SourceX1CoordinateLeft        = pFastCopyBltParam->dwSrcLeft;
+    cmd.DW6.SourceY1CoordinateTop         = pFastCopyBltParam->dwSrcTop;
+    cmd.DW7.SourcePitch                   = pFastCopyBltParam->dwSrcPitch;
+
+    // add source address
+    MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
+    ResourceParams.dwLsbNum        = MHW_BLT_ENGINE_STATE_BASE_ADDRESS_SHIFT;
+    ResourceParams.dwOffset        = srcOffset;
+    ResourceParams.presResource    = pFastCopyBltParam->pSrcOsResource;
+    ResourceParams.pdwCmd          = &(cmd.DW8_9.Value[0]);
+    ResourceParams.dwLocationInCmd = 8;
+    ResourceParams.bIsWritable     = true;
+
+    MHW_CHK_STATUS(pfnAddResourceToCmd(
+        m_osInterface,
+        pCmdBuffer,
+        &ResourceParams));
+
+    // add destination address
+    MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
+    ResourceParams.dwLsbNum        = MHW_BLT_ENGINE_STATE_BASE_ADDRESS_SHIFT;
+    ResourceParams.dwOffset        = dstOffset;
+    ResourceParams.presResource    = pFastCopyBltParam->pDstOsResource;
+    ResourceParams.pdwCmd          = &(cmd.DW4_5.Value[0]);
+    ResourceParams.dwLocationInCmd = 4;
+    ResourceParams.bIsWritable     = true;
+
+    MHW_CHK_STATUS(pfnAddResourceToCmd(
+        m_osInterface,
+        pCmdBuffer,
+        &ResourceParams));
+
+    Mos_AddCommand(pCmdBuffer, &cmd, cmd.byteSize);
+
+finish:
+    return eStatus;
+}
+
+MOS_STATUS MhwBltInterface::AddBlockCopyBlt(
+    PMOS_COMMAND_BUFFER      pCmdBuffer,
+    PMHW_FAST_COPY_BLT_PARAM pFastCopyBltParam, 
+    uint32_t                 srcOffset,
+    uint32_t                 dstOffset)
+{
+    MHW_FUNCTION_ENTER;
+
+    MHW_RESOURCE_PARAMS ResourceParams;
+    MOS_STATUS          eStatus;
+
+    eStatus = MOS_STATUS_SUCCESS;
+
+    mhw_blt_state::XY_BLOCK_COPY_BLT_CMD cmd;
+
+    cmd.DW0.ColorDepth = pFastCopyBltParam->dwColorDepth;
+    cmd.DW1.DestinationPitch = pFastCopyBltParam->dwDstPitch -1;
+    cmd.DW1.DestinationMocsValue =
+        m_osInterface->pfnGetGmmClientContext(m_osInterface)->CachePolicyGetMemoryObject(nullptr, GMM_RESOURCE_USAGE_BLT_DESTINATION).DwordValue;
+
+    cmd.DW1.DestinationTiling = (pFastCopyBltParam->pDstOsResource->TileType == MOS_TILE_LINEAR) ? 0:1; 
+    cmd.DW8.SourceTiling = (pFastCopyBltParam->pSrcOsResource->TileType == MOS_TILE_LINEAR) ? 0:1;
+    cmd.DW8.SourceMocs =
+        m_osInterface->pfnGetGmmClientContext(m_osInterface)->CachePolicyGetMemoryObject(nullptr, GMM_RESOURCE_USAGE_BLT_SOURCE).DwordValue;
+
+    cmd.DW2.DestinationX1CoordinateLeft = 0;
+    cmd.DW2.DestinationY1CoordinateTop = 0;
+    cmd.DW3.DestinationX2CoordinateRight = pFastCopyBltParam->dwDstRight;
+    cmd.DW3.DestinationY2CoordinateBottom = pFastCopyBltParam->dwDstBottom;
+    cmd.DW7.SourceX1CoordinateLeft = pFastCopyBltParam->dwSrcLeft;
+    cmd.DW7.SourceY1CoordinateTop = pFastCopyBltParam->dwSrcTop;
+    cmd.DW8.SourcePitch = pFastCopyBltParam->dwSrcPitch -1;
+
+    // add source address
+    MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
+    ResourceParams.dwLsbNum        = 12;
+    ResourceParams.dwOffset        = srcOffset;
+    ResourceParams.presResource    = pFastCopyBltParam->pSrcOsResource;
+    ResourceParams.pdwCmd          = &(cmd.DW9_10.Value[0]);
+    ResourceParams.dwLocationInCmd = 9;
+    ResourceParams.bIsWritable     = true;
+
+    MHW_CHK_STATUS(pfnAddResourceToCmd(
+        m_osInterface,
+        pCmdBuffer,
+        &ResourceParams));
+
+    // add destination address
+    MOS_ZeroMemory(&ResourceParams, sizeof(ResourceParams));
+    ResourceParams.dwLsbNum        = 12;
+    ResourceParams.dwOffset        = dstOffset;
+    ResourceParams.presResource    = pFastCopyBltParam->pDstOsResource;
+    ResourceParams.pdwCmd          = &(cmd.DW4_5.Value[0]);
+    ResourceParams.dwLocationInCmd = 4;
+    ResourceParams.bIsWritable     = true;
+
+    MHW_CHK_STATUS(pfnAddResourceToCmd(
+        m_osInterface,
+        pCmdBuffer,
+        &ResourceParams));
+
+    Mos_AddCommand(pCmdBuffer, &cmd, cmd.byteSize);
+
+finish:
+    return eStatus;
+}
+
+uint32_t MhwBltInterface::GetFastTilingMode(BLT_TILE_TYPE TileType)
+{
+   switch(TileType)
+   {
+      case BLT_NOT_TILED:
+          return mhw_blt_state::XY_FAST_COPY_BLT_CMD::DESTINATION_TILING_METHOD_LINEAR_TILINGDISABLED;
+      case BLT_TILED_Y:
+      case BLT_TILED_4:
+          return mhw_blt_state::XY_FAST_COPY_BLT_CMD::DESTINATION_TILING_METHOD_TILE_Y;
+      case BLT_TILED_64:
+          return mhw_blt_state::XY_FAST_COPY_BLT_CMD::DESTINATION_TILING_METHOD_64KBTILING;
+      default:
+         MHW_ASSERTMESSAGE("BLT: Can't support GMM TileType %d.", TileType);
+   }
+   return mhw_blt_state::XY_FAST_COPY_BLT_CMD::DESTINATION_TILING_METHOD_LINEAR_TILINGDISABLED;
+}
\ No newline at end of file
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_blt_legacy.h 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_blt_legacy.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_blt_legacy.h	1970-01-01 00:00:00.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_blt_legacy.h	2022-07-19 15:03:31.000000000 +0000
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+//!
+//! \file     mhw_blt_legacy.h
+//! \brief    MHW interface for constructing commands for the BLT
+//!
+#ifndef __MHW_BLT_LEGACY_H__
+#define __MHW_BLT_LEGACY_H__
+
+#include "mhw_blt.h"
+
+class MhwBltInterface
+{
+public:
+    MhwBltInterface(PMOS_INTERFACE pOsInterface);
+
+    virtual ~MhwBltInterface()
+    {
+        MHW_FUNCTION_ENTER;
+    }
+
+    //!
+    //! \brief    Add fast copy blt
+    //! \details  MHW function to add fast copy blt command
+    //! \param    [in] pCmdBuffer
+    //!           Pointer to Command buffer
+    //! \param    [in] pFastCopyBltParam
+    //!           Pointer to MHW_FAST_COPY_BLT_PARAM
+    //! \param    [in] srcOffset
+    //!           input surface's soruce offset
+    //! \param    [in] outOffset
+    //!           output surface's soruce offset
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS AddFastCopyBlt(
+        PMOS_COMMAND_BUFFER         pCmdBuffer,
+        PMHW_FAST_COPY_BLT_PARAM    pFastCopyBltParam,
+        uint32_t                    srcOffset,
+        uint32_t                    dstOffset);
+
+    //!
+    //! \brief    Add Block copy
+    //! \details  MHW function to add block copy command
+    //! \param    [in] pCmdBuffer
+    //!           Pointer to Command buffer
+    //! \param    [in] pFastCopyBltParam
+    //!           Pointer to MHW_FAST_COPY_BLT_PARAM
+    //! \param    [in] srcOffset
+    //!           input surface's soruce offset
+    //! \param    [in] outOffset
+    //!           output surface's soruce offset
+    //! \return   MOS_STATUS
+    //!           MOS_STATUS_SUCCESS if success, else fail reason
+    //!
+    virtual MOS_STATUS AddBlockCopyBlt(
+        PMOS_COMMAND_BUFFER         pCmdBuffer,
+        PMHW_FAST_COPY_BLT_PARAM    pFastCopyBltParam,
+        uint32_t                    srcOffset,
+        uint32_t                    dstOffset);
+
+    MOS_STATUS (*pfnAddResourceToCmd)(
+        PMOS_INTERFACE          pOsInterface,
+        PMOS_COMMAND_BUFFER     pCmdBuffer,
+        PMHW_RESOURCE_PARAMS    pParams);
+
+    //!
+    //! \brief    Get fastcopy tilling mode
+    //! \details  Get fastcopy tilling mode
+    //! \param    [in] TileType
+    //!           Pointer to BLT_TILE_TYPE
+    //! \return   uint32_t
+    //!           0:1:2:3
+    //!
+    virtual uint32_t GetFastTilingMode(
+        BLT_TILE_TYPE              TileType);
+
+    virtual std::shared_ptr<void> GetNewBltInterface() { return nullptr; }
+
+public:
+    PMOS_INTERFACE         m_osInterface = nullptr;
+    std::shared_ptr<void>  m_bltItfNew   = nullptr;
+};
+
+typedef class MhwBltInterface *PMHW_BLT_INTERFACE;
+
+#endif  // __MHW_BLT_LEGACY_H__
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_memory_pool.c 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_memory_pool.c
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_memory_pool.c	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_memory_pool.c	1970-01-01 00:00:00.000000000 +0000
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2015-2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file      mhw_memory_pool.c 
-//! \brief         This modules implements simple memory pool infrastructure for MHW 
-//!
-#include "mhw_memory_pool.h"
-#include "mhw_state_heap.h"
-
-typedef struct _MHW_MEMORY_POOL_ENTRY
-{
-    PMHW_MEMORY_POOL_ENTRY  pNext;              //!< Next pool entry (doubled linked list)
-    PMHW_MEMORY_POOL_ENTRY  pPrev;              //!< Prev pool entry (doubled linked list)
-    PMHW_MEMORY_POOL        pPool;              //!< Pool object
-    void                    *pAllocation;        //!< Memory allocation from malloc (to be freed)
-    uint32_t                dwSize;             //!< Memory size allocated from malloc
-    void                    *pObjects;           //!< Pointer to first object in this pool entry
-    uint32_t                dwCount;            //!< Number of objects in this pool allocation
-} MHW_MEMORY_POOL_ENTRY, *PMHW_MEMORY_POOL_ENTRY;
-
-MHW_MEMORY_POOL::MHW_MEMORY_POOL(uint32_t dwObjSize, uint32_t dwObjAlignment):
-    m_pFirst(nullptr),
-    m_pLast (nullptr),
-    m_dwCount(0),
-    m_dwSize(0),
-    m_dwObjSize(dwObjSize),
-    m_dwObjAlignment(dwObjAlignment),
-    m_dwObjCount(0)
-{
-
-}
-
-MHW_MEMORY_POOL::~MHW_MEMORY_POOL()
-{
-    PMHW_MEMORY_POOL_ENTRY pEntry;
-    PMHW_MEMORY_POOL_ENTRY pNext;
-
-    pEntry = m_pFirst;
-    while (pEntry)
-    {
-        pNext = pEntry->pNext;
-        if (pEntry->pAllocation)
-        {
-            MOS_FreeMemory(pEntry->pAllocation);
-        }
-        pEntry = pNext;
-    }
-}
-
-// Allocate an array of objects to be added to the pool
-void  *MHW_MEMORY_POOL::Allocate(uint32_t dwObjCount)
-{
-    uint8_t                *pObjects  = nullptr;
-    uint32_t               dwSize;
-    PMHW_MEMORY_POOL_ENTRY pEntry = nullptr;
-
-    if (dwObjCount == 0)
-    {
-        return nullptr;
-    }
-
-    // Calculate total size - pool entry + objects + alignments
-    dwSize = sizeof(MHW_MEMORY_POOL_ENTRY);
-    dwSize += m_dwObjSize * dwObjCount + m_dwObjAlignment;
-
-    pEntry = (PMHW_MEMORY_POOL_ENTRY) MOS_AllocMemory(dwSize);
-    if (!pEntry)
-    {
-        return nullptr;
-    }
-    MOS_ZeroMemory(pEntry, dwSize);
-
-    pObjects  = ((uint8_t*) pEntry) + sizeof(MHW_MEMORY_POOL_ENTRY);
-
-    // adjust alignment if necessary
-    if ((uintptr_t(pObjects) % m_dwObjAlignment))
-    {
-        // clear out lower bits
-        pObjects = (uint8_t*)((uintptr_t)pObjects & (~(uintptr_t)(m_dwObjAlignment - 1)));
-        // add alignment
-        pObjects += m_dwObjAlignment;
-    }
-
-    // Insert pool entry into linked list
-    pEntry->pNext = nullptr;
-    pEntry->pPrev = m_pLast;
-    m_pLast = pEntry;
-
-    if (pEntry->pPrev) pEntry->pPrev->pNext = pEntry;
-
-    if (!m_pFirst) m_pFirst = pEntry;
-
-    // Setup pool entry
-    pEntry->pPool       = this;
-    pEntry->pAllocation = (void *)pEntry;
-    pEntry->dwSize      = dwSize;
-    pEntry->pObjects    = pObjects;
-    pEntry->dwCount     = dwObjCount;
-
-    // Update pool object
-    m_dwCount++;
-    m_dwSize     += dwSize;
-    m_dwObjCount += dwObjCount;
-
-    return pObjects;
-}
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_memory_pool.h 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_memory_pool.h
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_memory_pool.h	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_memory_pool.h	1970-01-01 00:00:00.000000000 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2015-2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//!
-//! \file      mhw_memory_pool.h 
-//! \brief         This modules implements simple memory pool infrastructure for MHW 
-//!
-#ifndef __MHW_MEMORY_POOL_H__
-#define __MHW_MEMORY_POOL_H__
-
-#include "mos_os.h"
-
-typedef struct _MHW_MEMORY_POOL_ENTRY *PMHW_MEMORY_POOL_ENTRY;
-typedef struct MHW_MEMORY_POOL *PMHW_MEMORY_POOL;
-
-struct MHW_MEMORY_POOL
-{
-
-    PMHW_MEMORY_POOL_ENTRY  m_pFirst;             //!< First pool
-    PMHW_MEMORY_POOL_ENTRY  m_pLast;              //!< Last pool
-    uint32_t                m_dwCount;            //!< Number of pools
-    uint32_t                m_dwSize;             //!< Total memory in all pool objects
-    uint32_t                m_dwObjSize;          //!< Object size
-    uint32_t                m_dwObjAlignment;     //!< Object alignment
-    uint32_t                m_dwObjCount;         //!< Total number of objects in all pools
-
-    //!
-    //! \brief    Constructor of MHW_MEMORY_POOL
-    //! \details  Constructor of MHW_BLOCK_MANAGER which initializes all members
-    //! \param    [in] dwObjSize
-    //!           Size of object
-    //! \param    [in] dwObjAlignment
-    //!           Alignment of object
-    //!
-    MHW_MEMORY_POOL(uint32_t dwObjSize, uint32_t dwObjAlignment);
-
-    //!
-    //! \brief    Destructor of MHW_MEMORY_POOL
-    //! \details  Destructor of MHW_MEMORY_POOL which releases all the elements in the list
-    //!
-    ~MHW_MEMORY_POOL();
-
-    //!
-    //! \brief    Allocate objects 
-    //! \details  Allocate objects and insert them into list
-    //! \param    [in] dwObjCount
-    //!           Count of objects need to be allocated
-    //!
-    void  *Allocate(uint32_t dwObjCount);
-
-} ;
-
-#endif // __MHW_MEMORY_POOL_H__
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_mi.cpp 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_mi.cpp
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_mi.cpp	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_mi.cpp	2022-07-19 15:03:31.000000000 +0000
@@ -26,6 +26,7 @@
 //!
 
 #include "mhw_mi.h"
+#include "mhw_cp_interface.h"
 
 MhwMiInterface::MhwMiInterface(
     MhwCpInterface      *cpInterface,
diff -pruN 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_render.c 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_render.c
--- 22.4.3+ds1-1/media_driver/agnostic/common/hw/mhw_render.c	2022-05-26 10:31:12.000000000 +0000
+++ 22.5.1+ds1-1/media_driver/agnostic/common/hw/mhw_render.c	1970-01-01 00:00:00.000000000 +0000
@@ -1,164 +0,0 @@
-/*
-* Copyright (c) 2014-2017, Intel Corporation
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*/
-//! \file     mhw_render.c
-//! \brief    MHW interface for constructing commands for the render engine
-//! \details  Impelements the functionalities common across all platforms for MHW_RENDER
-//!
-
-#include "mhw_render.h"
-
-//!
-//! \brief    Allocates the MHW render interface internal parameters
-//! \details  Internal MHW function to allocate all parameters needed for the
-//!           render interface including the state heap interface
-//! \param    MHW_STATE_HEAP_SETTINGS stateHeapSettings
-//!           [in] Setting used to initialize the state heap interface
-//! \return   MOS_STATUS
-//!           MOS_STATUS_SUCCESS if success, else fail reason
-//!
-MOS_STATUS MhwRenderInterface::AllocateHeaps(
-    MHW_STATE_HEAP_SETTINGS         stateHeapSettings)
-{
-    MOS_STATUS                      eStatus = MOS_STATUS_SUCCESS;
-
-    MHW_FUNCTION_ENTER;
-
-    MHW_MI_CHK_NULL(m_stateHeapInterface);
-
-    if ((stateHeapSettings.dwIshSize > 0 ||
-        stateHeapSettings.dwDshSize > 0 ) &&
-        stateHeapSettings.dwNumSyncTags > 0)
-    {
-        MHW_MI_CHK_STATUS(m_stateHeapInterface->pfnCreate(
-            &m_stateHeapInterface,
-            stateHeapSettings));
-    }
-
-    return eStatus;
-}
-
-void MhwRenderInterface::InitPlatformCaps(
-    MEDIA_SYSTEM_INFO         *gtSystemInfo)
-{
-    if (gtSystemInfo == nullptr)
-    {
-        MHW_ASSERTMESSAGE("Invalid input pointer provided");
-        return;
-    }
-
-    MOS_ZeroMemory(&m_hwCaps, sizeof(MHW_RENDER_ENGINE_CAPS));
-
-    m_hwCaps.dwMaxUnormSamplers       = MHW_RENDER_ENGINE_SAMPLERS_MAX;
-    m_hwCaps.dwMaxAVSSamplers         = MHW_RENDER_ENGINE_SAMPLERS_AVS_MAX;
-    m_hwCaps.dwMaxBTIndex             = MHW_RENDER_ENGINE_SSH_SURFACES_PER_BT_MAX - 1;
-    m_hwCaps.dwMaxThreads             = gtSystemInfo->ThreadCount;
-    m_hwCaps.dwMaxMediaPayloadSize    = MHW_RENDER_ENGINE_MEDIA_PALOAD_SIZE_MAX;
-    m_hwCaps.dwMaxURBSize             = MHW_RENDER_ENGINE_URB_SIZE_MAX;
-    m_hwCaps.dwMaxURBEntries          = MHW_RENDER_ENGINE_URB_ENTRIES_MAX;
-    m_hwCaps.dwMaxSubslice            = gtSystemInfo->MaxSubSlicesSupported;
-    m_hwCaps.dwMaxEUIndex             = MHW_RENDER_ENGINE_EU_INDEX_MAX;
-    m_hwCaps.dwNumThreadsPerEU        = (gtSystemInfo->EUCount > 0) ?
-        gtSystemInfo->ThreadCount / gtSystemInfo->EUCount : 0;
-