Skip to content

Commit 58c09f1

Browse files
authored
Fail resource allocation if the U plane offset exceeds the HW limitions (#26)
1 parent 496a00f commit 58c09f1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Source/GmmLib/Texture/GmmTextureAlloc.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,17 @@ bool GmmLib::GmmTextureCalc::ValidateTexInfo(GMM_TEXTURE_INFO * pTexInfo,
344344
return false;
345345
}
346346

347+
if(GmmIsPlanar(pTexInfo->Format))
348+
{
349+
if((!GmmIsReconstructableSurface(pTexInfo->Format)) && (pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_U] >= GMM_MAX_UV_PLANE_Y_OFFSET))
350+
{
351+
GMM_ASSERTDPF(0,
352+
"GmmLib::GmmTextureCalc::ValidateTexInfo:Y offset of U plane"
353+
"exceeds max HW U plane Y offset restriction.\r\n");
354+
return false;
355+
}
356+
}
357+
347358
GMM_DPF_EXIT;
348359
return true;
349360
}

Source/GmmLib/inc/External/Common/GmmConst.h

+1
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ OTHER DEALINGS IN THE SOFTWARE.
5252
#define GMM_MEDIA_COMPRESSION_STATE_SIZE (64)
5353
#define GMM_CLEAR_COLOR_FLOAT_SIZE (16)
5454
#define GMM_MAX_LCU_SIZE 64 // Media Largest coding Unit
55+
#define GMM_MAX_UV_PLANE_Y_OFFSET GMM_KBYTE(16) // RENDER_SURFACE_STATE structure only have 0:13 bit to write Y Offset for U or UV Plan(max value is <16384)

0 commit comments

Comments
 (0)