Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86f73bc1 authored by Vikash Garodia's avatar Vikash Garodia
Browse files

msm: media: Allocate extra memory for YUV buffers



Allocate extra memory for UBWC color format to
prevent out-of-bounds access by hardware.

Change-Id: Iff1e06b4cb16e0a3e41b667eb9334af87d52cfb5
CRs-Fixed: 2013474
Signed-off-by: default avatarVikash Garodia <vgarodia@codeaurora.org>
parent eee829e6
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ enum color_fmts {
	 * Y_Stride = align(Width, 128)
	 * UV_Stride = align(Width, 128)
	 * Y_Scanlines = align(Height, 32)
	 * UV_Scanlines = align(Height/2, 16)
	 * UV_Scanlines = align((Height + 96)/2, 16)
	 * Y_UBWC_Plane_size = align(Y_Stride * Y_Scanlines, 4096)
	 * UV_UBWC_Plane_size = align(UV_Stride * UV_Scanlines, 4096)
	 * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
@@ -231,11 +231,11 @@ enum color_fmts {
	 * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
	 * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
	 * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
	 * Extradata = 8k
	 * Extradata = 16k
	 *
	 * Total size = align( Y_UBWC_Plane_size + UV_UBWC_Plane_size +
	 *           Y_Meta_Plane_size + UV_Meta_Plane_size
	 *           + max(Extradata, Y_Stride * 48), 4096)
	 *           + Extradata), 4096)
	 */
	COLOR_FMT_NV12_UBWC,
	/* Venus NV12 10-bit UBWC:
@@ -311,7 +311,7 @@ enum color_fmts {
	 * Y_Stride = align(Width * 4/3, 128)
	 * UV_Stride = align(Width * 4/3, 128)
	 * Y_Scanlines = align(Height, 32)
	 * UV_Scanlines = align(Height/2, 16)
	 * UV_Scanlines = align((Height + 96)/2, 16)
	 * Y_UBWC_Plane_Size = align(Y_Stride * Y_Scanlines, 4096)
	 * UV_UBWC_Plane_Size = align(UV_Stride * UV_Scanlines, 4096)
	 * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
@@ -320,11 +320,11 @@ enum color_fmts {
	 * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
	 * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
	 * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
	 * Extradata = 8k
	 * Extradata = 16k
	 *
	 * Total size = align(Y_UBWC_Plane_size + UV_UBWC_Plane_size +
	 *           Y_Meta_Plane_size + UV_Meta_Plane_size
	 *           + max(Extradata, Y_Stride * 48), 4096)
	 *           + Extradata), 4096)
	 */
	COLOR_FMT_NV12_BPP10_UBWC,
	/* Venus RGBA8888 format:
@@ -970,6 +970,7 @@ static inline unsigned int VENUS_BUFFER_SIZE(
		break;
	case COLOR_FMT_NV12_UBWC:
	case COLOR_FMT_NV12_BPP10_UBWC:
		uv_sclines = VENUS_UV_SCANLINES(color_fmt, height + 96);
		y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
		uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
		y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
@@ -982,8 +983,7 @@ static inline unsigned int VENUS_BUFFER_SIZE(
					uv_meta_scanlines, 4096);

		size = y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
			uv_meta_plane +
			MSM_MEDIA_MAX(extra_size + 8192, 48 * y_stride);
			uv_meta_plane + extra_size;
		size = MSM_MEDIA_ALIGN(size, 4096);
		break;
	case COLOR_FMT_P010_UBWC: