Skip to content

Commit

Permalink
[Media Common] [VP][MCPY]separate BLT Mocs and BCS SWCTRL per HAL
Browse files Browse the repository at this point in the history
separate BLT Mocs and BCS SWCTRL  per HAL.
  • Loading branch information
fenhu authored and intel-mediadev committed Sep 4, 2024
1 parent 722793d commit 6875da2
Show file tree
Hide file tree
Showing 9 changed files with 239 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,62 @@ class Cmd
static const size_t byteSize = 88;
};

//////////////////////////////////////////////////////////////////////////
/// @brief BCS_SWCTRL
/// @details
///
///
struct BCS_SWCTRL
{
union
{
struct
{
/// DWORD 0
uint32_t Reserved_0 : __CODEGEN_BITFIELD(0, 1); ///< U2
uint32_t Disable256Bctypegeneration : __CODEGEN_BITFIELD(2, 2); ///< U1
uint32_t ForceEnable4bitCCSupdate : __CODEGEN_BITFIELD(3, 3); ///< U1
uint32_t Reserved_4 : __CODEGEN_BITFIELD(4, 15); ///< U12
uint32_t Mask : __CODEGEN_BITFIELD(16, 31); ///< U16
};
uint32_t Value;
} DW0;

//////////////////////////////////////////////////////////////////////////
/// @name LOCAL ENUMERATIONS
/// @{

/// @brief U1
enum DISABLE_256B_CTYPE_GENERATION
{
DISABLE_256B_CTYPE_GENERATION_EN = 0, ///< Enable 256B ctype generation.
DISABLE_256B_CTYPE_GENERATION_DIS = 1, ///< Disable 256B ctype generation logic
};

/// @brief U1
enum FORCE_ENABLE_4_BIT_CCS_UPDATE
{
FORCE_ENABLE_4_BIT_CCS_UPDATE_DISABLE = 0, ///<
FORCE_ENABLE_4_BIT_CCS_UPDATE_ENABLE = 1, ///<
};

/// @brief
enum CONSTANTS_TYPE
{
COMMAND_LENGTH = 1, ///<
REGISTER_OFFSET = 0x22200, ///<
};

/// @brief Explicit member initialization function
BCS_SWCTRL()
{
DW0.Value = 0x0;
//DW0.Common.Disable256Bctypegeneration = DISABLE_256B_CTYPE_GENERATION_EN;
//DW0.Common.ForceEnable4bitCCSupdate = FORCE_ENABLE_4_BIT_CCS_UPDATE_DISABLE;
//DW0.Common.Mask = 0x0;
}
};

//!
//! \brief XY_FAST_COPY_BLT
//! \details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,62 @@ class Cmd
static const size_t byteSize = 88;
};

//////////////////////////////////////////////////////////////////////////
/// @brief BCS_SWCTRL
/// @details
///
///
struct BCS_SWCTRL
{
union
{
struct
{
/// DWORD 0
uint32_t Reserved_0 : __CODEGEN_BITFIELD(0, 1); ///< U2
uint32_t Disable256Bctypegeneration : __CODEGEN_BITFIELD(2, 2); ///< U1
uint32_t ForceEnable4bitCCSupdate : __CODEGEN_BITFIELD(3, 3); ///< U1
uint32_t Reserved_4 : __CODEGEN_BITFIELD(4, 15); ///< U12
uint32_t Mask : __CODEGEN_BITFIELD(16, 31); ///< U16
};
uint32_t Value;
} DW0;

//////////////////////////////////////////////////////////////////////////
/// @name LOCAL ENUMERATIONS
/// @{

/// @brief U1
enum DISABLE_256B_CTYPE_GENERATION
{
DISABLE_256B_CTYPE_GENERATION_EN = 0, ///< Enable 256B ctype generation.
DISABLE_256B_CTYPE_GENERATION_DIS = 1, ///< Disable 256B ctype generation logic
};

/// @brief U1
enum FORCE_ENABLE_4_BIT_CCS_UPDATE
{
FORCE_ENABLE_4_BIT_CCS_UPDATE_DISABLE = 0, ///<
FORCE_ENABLE_4_BIT_CCS_UPDATE_ENABLE = 1, ///<
};

/// @brief
enum CONSTANTS_TYPE
{
COMMAND_LENGTH = 1, ///<
REGISTER_OFFSET = 0x22200, ///<
};

/// @brief Explicit member initialization function
BCS_SWCTRL()
{
DW0.Value = 0x0;
//DW0.Common.Disable256Bctypegeneration = DISABLE_256B_CTYPE_GENERATION_EN;
//DW0.Common.ForceEnable4bitCCSupdate = FORCE_ENABLE_4_BIT_CCS_UPDATE_DISABLE;
//DW0.Common.Mask = 0x0;
}
};

//!
//! \brief XY_FAST_COPY_BLT
//! \details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,58 @@ class Cmd
static const size_t byteSize = 88;
};

struct BCS_SWCTRL_CMD
{
union
{
struct
{
/// DWORD 0
uint32_t Tile4Source : __CODEGEN_BITFIELD(0, 0); ///< U1
uint32_t Tile4Destination : __CODEGEN_BITFIELD(1, 1); ///< U1
uint32_t SystemMemoryThrottleThreshold : __CODEGEN_BITFIELD(2, 15); ///< U14
uint32_t Mask : __CODEGEN_BITFIELD(16, 31); ///< U16
};
uint32_t Value;
} DW0;

//////////////////////////////////////////////////////////////////////////
/// @name LOCAL ENUMERATIONS
/// @{
/// @brief U1
enum TILE_4_SOURCE
{
TILE_4_SOURCE_XMAJOR = 0, ///<
TILE_4_SOURCE_TILE4 = 1, ///<
};

/// @brief U1
enum TILE_4_DESTINATION
{
TILE_4_DESTINATION_XMAJOR = 0, ///<
TILE_4_DESTINATION_TILE4 = 1, ///
};
/// @brief
enum CONSTANTS_TYPE
{
COMMAND_LENGTH = 1, ///<
REGISTER_OFFSET = 0x22200, ///<
};
//! \name Initializations

//! \brief Explicit member initialization function
BCS_SWCTRL_CMD()
{
DW0.Value = 0;
DW0.Tile4Source = TILE_4_SOURCE_XMAJOR;
DW0.Tile4Destination = TILE_4_DESTINATION_XMAJOR;
DW0.SystemMemoryThrottleThreshold = 0x40;
DW0.Mask = 0x0;
}
static const size_t dwSize = 1;
static const size_t byteSize = 4;
};

//!
//! \brief XY_FAST_COPY_BLT
//! \details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ class Impl : public blt::Impl<mhw::blt::xe_lpm_plus_next::Cmd>
}

protected:
//!
//! \brief Get Block copy MOCS
//! \details BLT function to get the MOCS
//! \param [in] MOS_HW_RESOURCE_DEF
//! Pointer to UsageDef
//! \return uint32_t
//! return the MOCS value
//!
uint32_t GetBlockCopyBltMOCS(MOS_HW_RESOURCE_DEF UsageDef)
{
// MemoryObject will get 7 bits data. bit[0] for encrypt and bits[1-7] for MOCS.
return m_osItf->pfnCachePolicyGetMemoryObject(UsageDef,
m_osItf->pfnGetGmmClientContext(m_osItf)).DwordValue;
}

using base_t = blt::Impl<mhw::blt::xe_lpm_plus_next::Cmd>;
MEDIA_CLASS_DEFINE_END(mhw__blt__xe_lpm_plus_next__Impl)
}; // Impl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,17 @@ MOS_STATUS BltStateXe_Lpm_Plus_Base::Initialize()
return MOS_STATUS_SUCCESS;
}

MOS_STATUS BltStateXe_Lpm_Plus_Base::SetBCSSWCTR(MOS_COMMAND_BUFFER *cmdBuffer)
{
BLT_CHK_NULL_RETURN(m_miItf);
BLT_CHK_NULL_RETURN(cmdBuffer);

auto &Register = m_miItf->MHW_GETPAR_F(MI_LOAD_REGISTER_IMM)();
Register = {};
Register.dwRegister = mhw::blt::xe_lpm_plus_next::Cmd::BCS_SWCTRL_CMD::REGISTER_OFFSET;
mhw::blt::xe_lpm_plus_next::Cmd::BCS_SWCTRL_CMD swctrl;
Register.dwData = swctrl.DW0.Value;
BLT_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(MI_LOAD_REGISTER_IMM)(cmdBuffer));

return MOS_STATUS_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ class BltStateXe_Lpm_Plus_Base: virtual public BltStateNext
//!
virtual MOS_STATUS Initialize();

protected:
//!
//! \brief Set BCS_SWCTR cmd
//! \details Set BCS_SWCTR for Cmdbuffer
//! \param PMOS_COMMAND_BUFFER
//! [in] Pointer to PMOS_COMMAND_BUFFER
//! \return MOS_STATUS
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed
//!
virtual MOS_STATUS SetBCSSWCTR(MOS_COMMAND_BUFFER *cmdBuffer);

MEDIA_CLASS_DEFINE_END(BltStateXe_Lpm_Plus_Base)
};

Expand Down
24 changes: 18 additions & 6 deletions media_softlet/agnostic/common/hw/mhw_blt_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,11 @@ class Impl : public Itf, public mhw::Impl
cmd.DW0.InstructionTargetOpcode = 0x41;
cmd.DW0.ColorDepth = params.dwColorDepth;
cmd.DW1.DestinationPitch = params.dwDstPitch - 1;
cmd.DW1.DestinationMocsValue =
this->m_osItf->pfnCachePolicyGetMemoryObject(MOS_GMM_RESOURCE_USAGE_BLT_DESTINATION,
m_osItf->pfnGetGmmClientContext(m_osItf)).DwordValue;
cmd.DW1.DestinationMocsValue = GetBlockCopyBltMOCS(MOS_GMM_RESOURCE_USAGE_BLT_DESTINATION);

cmd.DW1.DestinationTiling = GetFastTilingMode(dstTiledMode);
cmd.DW8.SourceTiling = GetFastTilingMode(srcTiledMode);
cmd.DW8.SourceMocs =
this->m_osItf->pfnCachePolicyGetMemoryObject(MOS_GMM_RESOURCE_USAGE_BLT_SOURCE,
m_osItf->pfnGetGmmClientContext(m_osItf)).DwordValue;
cmd.DW8.SourceMocs = GetBlockCopyBltMOCS(MOS_GMM_RESOURCE_USAGE_BLT_SOURCE);

cmd.DW2.DestinationX1CoordinateLeft = 0;
cmd.DW2.DestinationY1CoordinateTop = 0;
Expand Down Expand Up @@ -223,6 +219,22 @@ class Impl : public Itf, public mhw::Impl
}

protected:
//!
//! \brief Get Block copy MOCS
//! \details BLT function to get the MOCS
//! \param [in] MOS_HW_RESOURCE_DEF
//! Pointer to UsageDef
//! \return uint32_t
//! return the MOCS value
//!
virtual uint32_t GetBlockCopyBltMOCS(MOS_HW_RESOURCE_DEF UsageDef)
{
// MemoryObject will get 7 bits data. only bits[1-7] save MOCS, while some
// platoforms only use 4 bits mocs.
return (m_osItf->pfnCachePolicyGetMemoryObject(UsageDef,
m_osItf->pfnGetGmmClientContext(m_osItf)).DwordValue & 0x1E) >>1;
}

using base_t = Itf;
MEDIA_CLASS_DEFINE_END(mhw__blt__Impl)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#ifdef min
#undef min
#endif

//!
//! \brief BltStateNext constructor
//! \details Initialize the BltStateNext members.
Expand Down Expand Up @@ -874,21 +873,7 @@ MOS_STATUS BltStateNext::SubmitCMD(
pBltStateParam->pDstSurface,
MCPY_PLANE_Y));

auto& Register = m_miItf->MHW_GETPAR_F(MI_LOAD_REGISTER_IMM)();
Register = {};
Register.dwRegister = mhw_blt_state::BCS_SWCTRL_XE::REGISTER_OFFSET;
mhw_blt_state::BCS_SWCTRL_XE swctrl;
if (pBltStateParam->pSrcSurface->TileType != MOS_TILE_LINEAR)
{
swctrl.DW0.Tile4Source = 1;
}
if (pBltStateParam->pDstSurface->TileType != MOS_TILE_LINEAR)
{//output tiled
swctrl.DW0.Tile4Destination = 1;
}
Register.dwData = swctrl.DW0.Value;
BLT_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(MI_LOAD_REGISTER_IMM)(&cmdBuffer));

BLT_CHK_STATUS_RETURN(SetBCSSWCTR(&cmdBuffer));
BLT_CHK_STATUS_RETURN(m_miItf->AddBLTMMIOPrologCmd(&cmdBuffer));
BLT_CHK_STATUS_RETURN(m_bltItf->AddBlockCopyBlt(
&cmdBuffer,
Expand Down Expand Up @@ -1076,4 +1061,10 @@ MOS_STATUS BltStateNext::SetPrologParamsforCmdbuffer(PMOS_COMMAND_BUFFER cmdBuff
}

return eStatus;
}

MOS_STATUS BltStateNext::SetBCSSWCTR(MOS_COMMAND_BUFFER *cmdBuffer)
{
MOS_UNUSED(cmdBuffer);
return MOS_STATUS_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ class BltStateNext
//!
MOS_STATUS SetPrologParamsforCmdbuffer(PMOS_COMMAND_BUFFER cmdBuffer);

//!
//! \brief Set BCS_SWCTR cmd
//! \details Set BCS_SWCTR for Cmdbuffer
//! \param PMOS_COMMAND_BUFFER
//! [in] Pointer to PMOS_COMMAND_BUFFER
//! \return MOS_STATUS
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed
//!
virtual MOS_STATUS SetBCSSWCTR(MOS_COMMAND_BUFFER *cmdBuffer);

public:
PMOS_INTERFACE m_osInterface = nullptr;
MhwInterfacesNext *m_mhwInterfaces = nullptr;
Expand Down

0 comments on commit 6875da2

Please sign in to comment.