Skip to content

Commit

Permalink
[CM] Change calculation of surface height for sw swizzling in MOS.
Browse files Browse the repository at this point in the history
Fix a segment fault.

Change-Id: I5db52ae69b438d84d2ba303b071df757efd0c8a5
  • Loading branch information
xiongzho authored and intel-mediadev committed Dec 24, 2018
1 parent 05ad970 commit edbf48b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions media_driver/linux/common/os/mos_graphicsresource_specific.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,12 @@ void* GraphicsResourceSpecific::Lock(OsContext* osContextPtr, LockParams& params
if (m_systemShadow)
{
int32_t flags = pOsContextSpecific->GetTileYFlag() ? 0 : 1;
uint64_t surfSize = m_gmmResInfo->GetSizeMainSurface();
MOS_OS_CHECK_CONDITION((m_tileType != MOS_TILE_Y), "Unsupported tile type", nullptr);
MOS_OS_CHECK_CONDITION((boPtr->size <= 0 || m_pitch <= 0), "Invalid BO size or pitch", nullptr);
Mos_SwizzleData((uint8_t*)boPtr->virt, m_systemShadow,
MOS_TILE_Y, MOS_TILE_LINEAR, boPtr->size / m_pitch, m_pitch, flags);
Mos_SwizzleData((uint8_t*)boPtr->virt, m_systemShadow,
MOS_TILE_Y, MOS_TILE_LINEAR,
(int32_t)(surfSize / m_pitch), m_pitch, flags);
}
}
else
Expand Down Expand Up @@ -555,8 +557,10 @@ MOS_STATUS GraphicsResourceSpecific::Unlock(OsContext* osContextPtr)
if (m_systemShadow)
{
int32_t flags = pOsContextSpecific->GetTileYFlag() ? 0 : 1;
Mos_SwizzleData(m_systemShadow, (uint8_t*)boPtr->virt,
MOS_TILE_LINEAR, MOS_TILE_Y, boPtr->size / m_pitch, m_pitch, flags);
uint64_t surfSize = m_gmmResInfo->GetSizeMainSurface();
Mos_SwizzleData(m_systemShadow, (uint8_t*)boPtr->virt,
MOS_TILE_LINEAR, MOS_TILE_Y,
(int32_t)(surfSize / m_pitch), m_pitch, flags);
MOS_FreeMemory(m_systemShadow);
m_systemShadow = nullptr;
}
Expand Down

0 comments on commit edbf48b

Please sign in to comment.