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

Commit f64e00c3 authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: sde: add internal a5x tile format for inline rotator" into msm-4.9

parents df88b49a 2c7cc25e
Loading
Loading
Loading
Loading
+44 −12
Original line number Diff line number Diff line
@@ -1186,9 +1186,11 @@ static int sde_rotator_enum_fmt_vid_cap(struct file *file,
	struct sde_rotator_ctx *ctx = sde_rotator_ctx_from_fh(fh);
	struct sde_rotator_device *rot_dev = ctx->rot_dev;
	struct sde_mdp_format_params *fmt;
	u32 pixfmt;
	u32 i, index, pixfmt;
	bool found = false;

	pixfmt = sde_rotator_get_pixfmt(rot_dev->mgr, f->index, false);
	for (i = 0, index = 0; index <= f->index; i++) {
		pixfmt = sde_rotator_get_pixfmt(rot_dev->mgr, i, false);
		if (!pixfmt)
			return -EINVAL;

@@ -1196,6 +1198,20 @@ static int sde_rotator_enum_fmt_vid_cap(struct file *file,
		if (!fmt)
			return -EINVAL;

		if (sde_mdp_is_private_format(fmt))
			continue;

		if (index == f->index) {
			found = true;
			break;
		}

		index++;
	}

	if (!found)
		return -EINVAL;

	f->pixelformat = pixfmt;
	strlcpy(f->description, fmt->description, sizeof(f->description));

@@ -1214,9 +1230,11 @@ static int sde_rotator_enum_fmt_vid_out(struct file *file,
	struct sde_rotator_ctx *ctx = sde_rotator_ctx_from_fh(fh);
	struct sde_rotator_device *rot_dev = ctx->rot_dev;
	struct sde_mdp_format_params *fmt;
	u32 pixfmt;
	u32 i, index, pixfmt;
	bool found = false;

	pixfmt = sde_rotator_get_pixfmt(rot_dev->mgr, f->index, true);
	for (i = 0, index = 0; index <= f->index; i++) {
		pixfmt = sde_rotator_get_pixfmt(rot_dev->mgr, i, true);
		if (!pixfmt)
			return -EINVAL;

@@ -1224,6 +1242,20 @@ static int sde_rotator_enum_fmt_vid_out(struct file *file,
		if (!fmt)
			return -EINVAL;

		if (sde_mdp_is_private_format(fmt))
			continue;

		if (index == f->index) {
			found = true;
			break;
		}

		index++;
	}

	if (!found)
		return -EINVAL;

	f->pixelformat = pixfmt;
	strlcpy(f->description, fmt->description, sizeof(f->description));

+260 −26
Original line number Diff line number Diff line
/* Copyright (c) 2012, 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012, 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -31,9 +31,9 @@
		.pixel_mode = SDE_MDP_PIXEL_NORMAL,		\
		.element = { (e0), (e1), (e2) },		\
		.bits = {					\
			[C2_R_Cr] = COLOR_5BIT,			\
			[C0_G_Y] = COLOR_6BIT,			\
			[C1_B_Cb] = COLOR_5BIT,			\
			[C2_R_Cr] = SDE_COLOR_5BIT,		\
			[C0_G_Y] = SDE_COLOR_6BIT,		\
			[C1_B_Cb] = SDE_COLOR_5BIT,		\
		},						\
		.is_ubwc = isubwc,				\
	}
@@ -53,9 +53,9 @@
		.pixel_mode = SDE_MDP_PIXEL_NORMAL,		\
		.element = { (e0), (e1), (e2) },		\
		.bits = {					\
			[C2_R_Cr] = COLOR_8BIT,			\
			[C0_G_Y] = COLOR_8BIT,			\
			[C1_B_Cb] = COLOR_8BIT,			\
			[C2_R_Cr] = SDE_COLOR_8BIT,		\
			[C0_G_Y] = SDE_COLOR_8BIT,		\
			[C1_B_Cb] = SDE_COLOR_8BIT,		\
		},						\
		.is_ubwc = isubwc,				\
	}
@@ -76,10 +76,10 @@
		.pixel_mode = SDE_MDP_PIXEL_NORMAL,		\
		.element = { (e0), (e1), (e2), (e3) },		\
		.bits = {					\
			[C3_ALPHA] = COLOR_8BIT,		\
			[C2_R_Cr] = COLOR_8BIT,			\
			[C0_G_Y] = COLOR_8BIT,			\
			[C1_B_Cb] = COLOR_8BIT,			\
			[C3_ALPHA] = SDE_COLOR_8BIT,		\
			[C2_R_Cr] = SDE_COLOR_8BIT,		\
			[C0_G_Y] = SDE_COLOR_8BIT,		\
			[C1_B_Cb] = SDE_COLOR_8BIT,		\
		},						\
		.is_ubwc = isubwc,				\
	}
@@ -88,9 +88,9 @@
		.format = (fmt),				\
		.is_yuv = 1,					\
		.bits = {					\
			[C2_R_Cr] = COLOR_8BIT,			\
			[C0_G_Y] = COLOR_8BIT,			\
			[C1_B_Cb] = COLOR_8BIT,			\
			[C2_R_Cr] = SDE_COLOR_8BIT,		\
			[C0_G_Y] = SDE_COLOR_8BIT,		\
			[C1_B_Cb] = SDE_COLOR_8BIT,		\
		},						\
		.alpha_enable = 0,				\
		.unpack_tight = 1,				\
@@ -143,10 +143,10 @@
		.frame_format = SDE_MDP_FMT_LINEAR,		\
		.pixel_mode = SDE_MDP_PIXEL_NORMAL,		\
		.bits = {					\
			[C3_ALPHA] = COLOR_ALPHA_1BIT,		\
			[C2_R_Cr] = COLOR_5BIT,			\
			[C0_G_Y] = COLOR_5BIT,			\
			[C1_B_Cb] = COLOR_5BIT,			\
			[C3_ALPHA] = SDE_COLOR_ALPHA_1BIT,	\
			[C2_R_Cr] = SDE_COLOR_5BIT,		\
			[C0_G_Y] = SDE_COLOR_5BIT,		\
			[C1_B_Cb] = SDE_COLOR_5BIT,		\
		},						\
		.is_ubwc = SDE_MDP_COMPRESS_NONE,		\
	}
@@ -166,10 +166,10 @@
		.pixel_mode = SDE_MDP_PIXEL_NORMAL,		\
		.element = { (e0), (e1), (e2), (e3) },		\
		.bits = {					\
			[C3_ALPHA] = COLOR_ALPHA_4BIT,		\
			[C2_R_Cr] = COLOR_4BIT,			\
			[C0_G_Y] = COLOR_4BIT,			\
			[C1_B_Cb] = COLOR_4BIT,			\
			[C3_ALPHA] = SDE_COLOR_ALPHA_4BIT,	\
			[C2_R_Cr] = SDE_COLOR_4BIT,		\
			[C0_G_Y] = SDE_COLOR_4BIT,		\
			[C1_B_Cb] = SDE_COLOR_4BIT,		\
		},						\
		.is_ubwc = SDE_MDP_COMPRESS_NONE,		\
	}
@@ -190,10 +190,10 @@
		.pixel_mode = SDE_MDP_PIXEL_10BIT,		\
		.element = { (e0), (e1), (e2), (e3) },		\
		.bits = {					\
			[C3_ALPHA] = COLOR_8BIT,		\
			[C2_R_Cr] = COLOR_8BIT,			\
			[C0_G_Y] = COLOR_8BIT,			\
			[C1_B_Cb] = COLOR_8BIT,			\
			[C3_ALPHA] = SDE_COLOR_8BIT,		\
			[C2_R_Cr] = SDE_COLOR_8BIT,		\
			[C0_G_Y] = SDE_COLOR_8BIT,		\
			[C1_B_Cb] = SDE_COLOR_8BIT,		\
		},						\
		.is_ubwc = isubwc,				\
	}
@@ -283,6 +283,240 @@ static struct sde_mdp_format_params_ubwc sde_mdp_format_ubwc_map[] = {
			.tile_width = 48,
		},
	},
	{
		.mdp_format =
			FMT_RGB_1010102(SDE_PIX_FMT_RGBA_1010102_TILE,
			"SDE/RGBA_1010102_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			1, C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_1010102(SDE_PIX_FMT_RGBX_1010102_TILE,
			"SDE/RGBX_1010102102_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			0, C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_1010102(SDE_PIX_FMT_BGRA_1010102_TILE,
			"SDE/BGRA_1010102_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			1, C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_1010102(SDE_PIX_FMT_BGRX_1010102_TILE,
			"SDE/BGRX_1010102_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			0, C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_1010102(SDE_PIX_FMT_ARGB_2101010_TILE,
			"SDE/ARGB_2101010_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			1, C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_1010102(SDE_PIX_FMT_XRGB_2101010_TILE,
			"SDE/XRGB_2101010_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			0, C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_1010102(SDE_PIX_FMT_ABGR_2101010_TILE,
			"SDE/ABGR_2101010_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			1, C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_1010102(SDE_PIX_FMT_XBGR_2101010_TILE,
			"SDE/XBGR_2101010_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			0, C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_YUV_PSEUDO(SDE_PIX_FMT_Y_CRCB_H2V2_TILE,
			"Y_CRCB_H2V2_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_CHROMA_420, SDE_MDP_PIXEL_NORMAL,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			C2_R_Cr, C1_B_Cb, SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 8,
			.tile_width = 32,
		},
	},
	{
		.mdp_format =
			FMT_YUV_PSEUDO(SDE_PIX_FMT_Y_CBCR_H2V2_TILE,
			"Y_CBCR_H2V2_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_CHROMA_420, SDE_MDP_PIXEL_NORMAL,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			C1_B_Cb, C2_R_Cr, SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 8,
			.tile_width = 32,
		},
	},
	{
		.mdp_format =
			FMT_RGB_8888(SDE_PIX_FMT_ABGR_8888_TILE,
			"SDE/ABGR_8888_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			1, C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_8888(SDE_PIX_FMT_XRGB_8888_TILE,
			"SDE/XRGB_8888_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			0, C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 32,
		},
	},
	{
		.mdp_format =
			FMT_RGB_8888(SDE_PIX_FMT_ARGB_8888_TILE,
			"SDE/ARGB_8888_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			1, C3_ALPHA, C2_R_Cr, C0_G_Y, C1_B_Cb,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_8888(SDE_PIX_FMT_RGBA_8888_TILE,
			"SDE/RGBA_8888_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			1, C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_8888(SDE_PIX_FMT_RGBX_8888_TILE,
			"SDE/RGBX_8888_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			0, C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_8888(SDE_PIX_FMT_BGRA_8888_TILE,
			"SDE/BGRA_8888_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			1, C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_8888(SDE_PIX_FMT_BGRX_8888_TILE,
			"SDE/BGRX_8888_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			0, C1_B_Cb, C0_G_Y, C2_R_Cr, C3_ALPHA,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
	{
		.mdp_format =
			FMT_RGB_8888(SDE_PIX_FMT_XBGR_8888_TILE,
			"SDE/XBGR_8888_TILE",
			SDE_MDP_FMT_TILE_A5X,
			SDE_MDP_FORMAT_FLAG_PRIVATE,
			0, C3_ALPHA, C1_B_Cb, C0_G_Y, C2_R_Cr,
			SDE_MDP_COMPRESS_NONE),
		.micro = {
			.tile_height = 4,
			.tile_width = 16,
		},
	},
};

static struct sde_mdp_format_params sde_mdp_format_map[] = {
+46 −6
Original line number Diff line number Diff line
@@ -17,6 +17,27 @@
#include <linux/types.h>
#include <media/msm_sde_rotator.h>

/* Internal rotator pixel formats */
#define SDE_PIX_FMT_RGBA_8888_TILE	v4l2_fourcc('Q', 'T', '0', '0')
#define SDE_PIX_FMT_RGBX_8888_TILE	v4l2_fourcc('Q', 'T', '0', '1')
#define SDE_PIX_FMT_BGRA_8888_TILE	v4l2_fourcc('Q', 'T', '0', '2')
#define SDE_PIX_FMT_BGRX_8888_TILE	v4l2_fourcc('Q', 'T', '0', '3')
#define SDE_PIX_FMT_ARGB_8888_TILE	v4l2_fourcc('Q', 'T', '0', '4')
#define SDE_PIX_FMT_XRGB_8888_TILE	v4l2_fourcc('Q', 'T', '0', '5')
#define SDE_PIX_FMT_ABGR_8888_TILE	v4l2_fourcc('Q', 'T', '0', '6')
#define SDE_PIX_FMT_XBGR_8888_TILE	v4l2_fourcc('Q', 'T', '0', '7')
#define SDE_PIX_FMT_Y_CBCR_H2V2_TILE	v4l2_fourcc('Q', 'T', '0', '8')
#define SDE_PIX_FMT_Y_CRCB_H2V2_TILE	v4l2_fourcc('Q', 'T', '0', '9')
#define SDE_PIX_FMT_ARGB_2101010_TILE	v4l2_fourcc('Q', 'T', '0', 'A')
#define SDE_PIX_FMT_XRGB_2101010_TILE	v4l2_fourcc('Q', 'T', '0', 'B')
#define SDE_PIX_FMT_ABGR_2101010_TILE	v4l2_fourcc('Q', 'T', '0', 'C')
#define SDE_PIX_FMT_XBGR_2101010_TILE	v4l2_fourcc('Q', 'T', '0', 'D')
#define SDE_PIX_FMT_BGRA_1010102_TILE	v4l2_fourcc('Q', 'T', '0', 'E')
#define SDE_PIX_FMT_BGRX_1010102_TILE	v4l2_fourcc('Q', 'T', '0', 'F')
#define SDE_PIX_FMT_RGBA_1010102_TILE	v4l2_fourcc('Q', 'T', '1', '0')
#define SDE_PIX_FMT_RGBX_1010102_TILE	v4l2_fourcc('Q', 'T', '1', '1')
#define SDE_PIX_FMT_Y_CBCR_H2V2_P010_TILE	v4l2_fourcc('Q', 'T', '1', '2')

#define SDE_ROT_MAX_PLANES		4

#define UBWC_META_MACRO_W_H		16
@@ -27,12 +48,12 @@
 * expected by the HW programming.
 */
enum {
	COLOR_4BIT,
	COLOR_5BIT,
	COLOR_6BIT,
	COLOR_8BIT,
	COLOR_ALPHA_1BIT = 0,
	COLOR_ALPHA_4BIT = 1,
	SDE_COLOR_4BIT,
	SDE_COLOR_5BIT,
	SDE_COLOR_6BIT,
	SDE_COLOR_8BIT,
	SDE_COLOR_ALPHA_1BIT = 0,
	SDE_COLOR_ALPHA_4BIT = 1,
};

#define C3_ALPHA	3	/* alpha */
@@ -69,6 +90,10 @@ enum sde_mdp_sspp_chroma_samp_type {
	SDE_MDP_CHROMA_420
};

enum sde_mdp_format_flag_type {
	SDE_MDP_FORMAT_FLAG_PRIVATE = BIT(0)
};

struct sde_mdp_format_params {
	u32 format;
	const char *description;
@@ -158,4 +183,19 @@ static inline bool sde_mdp_is_yuv_format(struct sde_mdp_format_params *fmt)
{
	return fmt && fmt->is_yuv;
}

static inline bool sde_mdp_is_rgb_format(struct sde_mdp_format_params *fmt)
{
	return !sde_mdp_is_yuv_format(fmt);
}

static inline bool sde_mdp_is_private_format(struct sde_mdp_format_params *fmt)
{
	return fmt && (fmt->flag & SDE_MDP_FORMAT_FLAG_PRIVATE);
}

static inline int sde_mdp_format_blk_size(struct sde_mdp_format_params *fmt)
{
	return sde_mdp_is_tp10_format(fmt) ? 96 : 128;
}
#endif
+45 −25
Original line number Diff line number Diff line
@@ -179,13 +179,13 @@ int sde_mdp_get_rau_strides(u32 w, u32 h,
	return 0;
}

static int sde_mdp_get_ubwc_plane_size(struct sde_mdp_format_params *fmt,
static int sde_mdp_get_a5x_plane_size(struct sde_mdp_format_params *fmt,
	u32 width, u32 height, struct sde_mdp_plane_sizes *ps)
{
	int rc = 0;

	if (fmt->format == SDE_PIX_FMT_Y_CBCR_H2V2_UBWC) {
		ps->num_planes = 4;
	if (sde_mdp_is_nv12_8b_format(fmt)) {
		ps->num_planes = 2;
		/* Y bitstream stride and plane size */
		ps->ystride[0] = ALIGN(width, 128);
		ps->plane_size[0] = ALIGN(ps->ystride[0] * ALIGN(height, 32),
@@ -196,6 +196,11 @@ static int sde_mdp_get_ubwc_plane_size(struct sde_mdp_format_params *fmt,
		ps->plane_size[1] = ALIGN(ps->ystride[1] *
			ALIGN(height / 2, 32), 4096);

		if (!sde_mdp_is_ubwc_format(fmt))
			goto done;

		ps->num_planes += 2;

		/* Y meta data stride and plane size */
		ps->ystride[2] = ALIGN(DIV_ROUND_UP(width, 32), 64);
		ps->plane_size[2] = ALIGN(ps->ystride[2] *
@@ -205,13 +210,13 @@ static int sde_mdp_get_ubwc_plane_size(struct sde_mdp_format_params *fmt,
		ps->ystride[3] = ALIGN(DIV_ROUND_UP(width / 2, 16), 64);
		ps->plane_size[3] = ALIGN(ps->ystride[3] *
			ALIGN(DIV_ROUND_UP(height / 2, 8), 16), 4096);
	} else if (fmt->format == SDE_PIX_FMT_Y_CBCR_H2V2_TP10_UBWC) {
	} else if (sde_mdp_is_tp10_format(fmt)) {
		u32 yWidth   = sde_mdp_general_align(width, 192);
		u32 yHeight  = ALIGN(height, 16);
		u32 uvWidth  = sde_mdp_general_align(width, 192);
		u32 uvHeight = ALIGN(height, 32);

		ps->num_planes = 4;
		ps->num_planes = 2;

		/* Y bitstream stride and plane size */
		ps->ystride[0]    = yWidth * TILEWIDTH_SIZE / Y_TILEWIDTH;
@@ -225,6 +230,11 @@ static int sde_mdp_get_ubwc_plane_size(struct sde_mdp_format_params *fmt,
				(uvHeight * TILEHEIGHT_SIZE / UV_TILEHEIGHT),
				4096);

		if (!sde_mdp_is_ubwc_format(fmt))
			goto done;

		ps->num_planes += 2;

		/* Y meta data stride and plane size */
		ps->ystride[2]    = ALIGN(yWidth / Y_TILEWIDTH, 64);
		ps->plane_size[2] = ALIGN(ps->ystride[2] *
@@ -234,11 +244,7 @@ static int sde_mdp_get_ubwc_plane_size(struct sde_mdp_format_params *fmt,
		ps->ystride[3]    = ALIGN(uvWidth / UV_TILEWIDTH, 64);
		ps->plane_size[3] = ALIGN(ps->ystride[3] *
				ALIGN((uvHeight / UV_TILEHEIGHT), 16), 4096);
	} else if (fmt->format == SDE_PIX_FMT_RGBA_8888_UBWC ||
		fmt->format == SDE_PIX_FMT_RGBX_8888_UBWC    ||
		fmt->format == SDE_PIX_FMT_RGBA_1010102_UBWC ||
		fmt->format == SDE_PIX_FMT_RGBX_1010102_UBWC ||
		fmt->format == SDE_PIX_FMT_RGB_565_UBWC) {
	} else if (sde_mdp_is_rgb_format(fmt)) {
		uint32_t stride_alignment, bpp, aligned_bitstream_width;

		if (fmt->format == SDE_PIX_FMT_RGB_565_UBWC) {
@@ -248,7 +254,8 @@ static int sde_mdp_get_ubwc_plane_size(struct sde_mdp_format_params *fmt,
			stride_alignment = 64;
			bpp = 4;
		}
		ps->num_planes = 2;

		ps->num_planes = 1;

		/* RGB bitstream stride and plane size */
		aligned_bitstream_width = ALIGN(width, stride_alignment);
@@ -256,6 +263,11 @@ static int sde_mdp_get_ubwc_plane_size(struct sde_mdp_format_params *fmt,
		ps->plane_size[0] = ALIGN(bpp * aligned_bitstream_width *
			ALIGN(height, 16), 4096);

		if (!sde_mdp_is_ubwc_format(fmt))
			goto done;

		ps->num_planes += 1;

		/* RGB meta data stride and plane size */
		ps->ystride[2] = ALIGN(DIV_ROUND_UP(aligned_bitstream_width,
			16), 64);
@@ -266,7 +278,7 @@ static int sde_mdp_get_ubwc_plane_size(struct sde_mdp_format_params *fmt,
			__func__, fmt->format);
		rc = -EINVAL;
	}

done:
	return rc;
}

@@ -285,8 +297,8 @@ int sde_mdp_get_plane_sizes(struct sde_mdp_format_params *fmt, u32 w, u32 h,
	bpp = fmt->bpp;
	memset(ps, 0, sizeof(struct sde_mdp_plane_sizes));

	if (sde_mdp_is_ubwc_format(fmt)) {
		rc = sde_mdp_get_ubwc_plane_size(fmt, w, h, ps);
	if (sde_mdp_is_tilea5x_format(fmt)) {
		rc = sde_mdp_get_a5x_plane_size(fmt, w, h, ps);
	} else if (bwc_mode) {
		u32 height, meta_size;

@@ -394,7 +406,7 @@ int sde_mdp_get_plane_sizes(struct sde_mdp_format_params *fmt, u32 w, u32 h,
	return rc;
}

static int sde_mdp_ubwc_data_check(struct sde_mdp_data *data,
static int sde_mdp_a5x_data_check(struct sde_mdp_data *data,
			struct sde_mdp_plane_sizes *ps,
			struct sde_mdp_format_params *fmt)
{
@@ -416,8 +428,7 @@ static int sde_mdp_ubwc_data_check(struct sde_mdp_data *data,

	base_addr = data->p[0].addr;

	if ((fmt->format == SDE_PIX_FMT_Y_CBCR_H2V2_UBWC) ||
		(fmt->format == SDE_PIX_FMT_Y_CBCR_H2V2_TP10_UBWC)) {
	if (sde_mdp_is_yuv_format(fmt)) {
		/************************************************/
		/*      UBWC            **                      */
		/*      buffer          **      MDP PLANE       */
@@ -447,6 +458,9 @@ static int sde_mdp_ubwc_data_check(struct sde_mdp_data *data,
			+ ps->plane_size[2] + ps->plane_size[3];
		data->p[1].len = ps->plane_size[1];

		if (!sde_mdp_is_ubwc_format(fmt))
			goto done;

		/* configure Y metadata plane */
		data->p[2].addr = base_addr;
		data->p[2].len = ps->plane_size[2];
@@ -477,10 +491,14 @@ static int sde_mdp_ubwc_data_check(struct sde_mdp_data *data,
		data->p[0].addr = base_addr + ps->plane_size[2];
		data->p[0].len = ps->plane_size[0];

		if (!sde_mdp_is_ubwc_format(fmt))
			goto done;

		/* configure RGB metadata plane */
		data->p[2].addr = base_addr;
		data->p[2].len = ps->plane_size[2];
	}
done:
	data->num_planes = ps->num_planes;

end:
@@ -490,7 +508,7 @@ static int sde_mdp_ubwc_data_check(struct sde_mdp_data *data,
		return -EINVAL;
	}

	inc = ((fmt->format == SDE_PIX_FMT_Y_CBCR_H2V2_UBWC) ? 1 : 2);
	inc = (sde_mdp_is_yuv_format(fmt) ? 1 : 2);
	for (i = 0; i < SDE_ROT_MAX_PLANES; i += inc) {
		if (data->p[i].len != ps->plane_size[i]) {
			SDEROT_ERR(
@@ -517,8 +535,8 @@ int sde_mdp_data_check(struct sde_mdp_data *data,
	if (!data || data->num_planes == 0)
		return -ENOMEM;

	if (sde_mdp_is_ubwc_format(fmt))
		return sde_mdp_ubwc_data_check(data, ps, fmt);
	if (sde_mdp_is_tilea5x_format(fmt))
		return sde_mdp_a5x_data_check(data, ps, fmt);

	SDEROT_DBG("srcp0=%pa len=%lu frame_size=%u\n", &data->p[0].addr,
		data->p[0].len, ps->total_size);
@@ -574,7 +592,7 @@ int sde_validate_offset_for_ubwc_format(
	return ret;
}

/* x and y are assumednt to be valid, expected to line up with start of tiles */
/* x and y are assumed to be valid, expected to line up with start of tiles */
void sde_rot_ubwc_data_calc_offset(struct sde_mdp_data *data, u16 x, u16 y,
	struct sde_mdp_plane_sizes *ps, struct sde_mdp_format_params *fmt)
{
@@ -589,7 +607,7 @@ void sde_rot_ubwc_data_calc_offset(struct sde_mdp_data *data, u16 x, u16 y,
	}
	macro_w = 4 * micro_w;

	if (fmt->format == SDE_PIX_FMT_Y_CBCR_H2V2_UBWC) {
	if (sde_mdp_is_nv12_8b_format(fmt)) {
		u16 chroma_macro_w = macro_w / 2;
		u16 chroma_micro_w = micro_w / 2;

@@ -631,9 +649,11 @@ void sde_rot_ubwc_data_calc_offset(struct sde_mdp_data *data, u16 x, u16 y,
			ret = 4;
			goto done;
		}
	} else if (fmt->format == SDE_PIX_FMT_Y_CBCR_H2V2_TP10_UBWC) {
	} else if (sde_mdp_is_nv12_10b_format(fmt)) {
		/* TODO: */
		SDEROT_ERR("UBWC TP10 format not implemented yet");
		SDEROT_ERR("%c%c%c%c format not implemented yet",
				fmt->format >> 0, fmt->format >> 8,
				fmt->format >> 16, fmt->format >> 24);
		ret = 1;
		goto done;
	} else {
@@ -670,7 +690,7 @@ void sde_rot_data_calc_offset(struct sde_mdp_data *data, u16 x, u16 y,
	if ((x == 0) && (y == 0))
		return;

	if (sde_mdp_is_ubwc_format(fmt)) {
	if (sde_mdp_is_tilea5x_format(fmt)) {
		sde_rot_ubwc_data_calc_offset(data, x, y, ps, fmt);
		return;
	}