Failing the resource allocation if the U plane offset exceeds the HW limitations (#191)
diff --git a/Source/GmmLib/Texture/GmmTextureAlloc.cpp b/Source/GmmLib/Texture/GmmTextureAlloc.cpp
index 6184032..6b6f525 100644
--- a/Source/GmmLib/Texture/GmmTextureAlloc.cpp
+++ b/Source/GmmLib/Texture/GmmTextureAlloc.cpp
@@ -349,6 +349,17 @@
return false;
}
+ if(GmmIsPlanar(pTexInfo->Format))
+ {
+ if((!GmmIsReconstructableSurface(pTexInfo->Format)) && (pTexInfo->OffsetInfo.Plane.Y[GMM_PLANE_U] >= GMM_MAX_UV_PLANE_Y_OFFSET))
+ {
+ GMM_ASSERTDPF(0,
+ "GmmLib::GmmTextureCalc::ValidateTexInfo:Y offset of U plane"
+ "exceeds max HW U plane Y offset restriction.\r\n");
+ return false;
+ }
+ }
+
GMM_DPF_EXIT;
return true;
}
diff --git a/Source/GmmLib/inc/External/Common/GmmConst.h b/Source/GmmLib/inc/External/Common/GmmConst.h
index 8ae77e3..f426722 100644
--- a/Source/GmmLib/inc/External/Common/GmmConst.h
+++ b/Source/GmmLib/inc/External/Common/GmmConst.h
@@ -54,3 +54,4 @@
#define GMM_MEDIA_COMPRESSION_STATE_SIZE (64)
#define GMM_CLEAR_COLOR_FLOAT_SIZE (16)
#define GMM_MAX_LCU_SIZE 64 // Media Largest coding Unit
+#define GMM_MAX_UV_PLANE_Y_OFFSET GMM_KBYTE(16) // RENDER_SURFACE_STATE limits to write Y Offset for U or UV Plane so that max value is < 16384