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

Commit 4e5d6408 authored by Vikash Garodia's avatar Vikash Garodia Committed by Gerrit - the friendly Code Review server
Browse files

msm: media: uapi: Redefine NV12 format with different alignment



Consider NV12 color format alignment differently for 32bit and
64 bit compilation.

Change-Id: Iffd2335f473b765085e9ffeb485b3015cccf1eab
Signed-off-by: default avatarVikash Garodia <vgarodia@codeaurora.org>
parent 5de2f678
Loading
Loading
Loading
Loading
+35 −8
Original line number Diff line number Diff line
@@ -2,6 +2,23 @@
#ifndef __MSM_MEDIA_INFO_H__
#define __MSM_MEDIA_INFO_H__

#include <asm/bitsperlong.h>

#if __BITS_PER_LONG == 64
#define NV12_STRIDE_ALIGNMENT 512
#define NV12_SCANLINE_ALIGNMENT 512
#else
#define NV12_STRIDE_ALIGNMENT 128
#define NV12_SCANLINE_ALIGNMENT 32
#endif

#ifdef VENUS_USE_64BIT_ALIGNMENT
#undef NV12_STRIDE_ALIGNMENT
#undef NV12_SCANLINE_ALIGNMENT
#define NV12_STRIDE_ALIGNMENT 512
#define NV12_SCANLINE_ALIGNMENT 512
#endif

/* Width and Height should be multiple of 16 */
#define INTERLACE_WIDTH_MAX 1920
#define INTERLACE_HEIGHT_MAX 1920
@@ -45,10 +62,10 @@ enum color_fmts {
	 * . . . . . . . . . . . . . . . .  V
	 * . . . . . . . . . . . . . . . .  --> Buffer size alignment
	 *
	 * Y_Stride : Width aligned to 512
	 * UV_Stride : Width aligned to 512
	 * Y_Scanlines: Height aligned to 512
	 * UV_Scanlines: Height/2 aligned to 256
	 * Y_Stride : Width aligned to 512 or 128
	 * UV_Stride : Width aligned to 512 or 128
	 * Y_Scanlines: Height aligned to 512 or 32
	 * UV_Scanlines: Height/2 aligned to 256 or 16
	 * Total size = align(Y_Stride * Y_Scanlines
	 *          + UV_Stride * UV_Scanlines, 4096)
	 */
@@ -80,10 +97,10 @@ enum color_fmts {
	 * . . . . . . . . . . . . . . . .  V
	 * . . . . . . . . . . . . . . . .  --> Padding & Buffer size alignment
	 *
	 * Y_Stride : Width aligned to 512
	 * UV_Stride : Width aligned to 512
	 * Y_Scanlines: Height aligned to 512
	 * UV_Scanlines: Height/2 aligned to 256
	 * Y_Stride : Width aligned to 512 or 128
	 * UV_Stride : Width aligned to 512 or 128
	 * Y_Scanlines: Height aligned to 512 or 32
	 * UV_Scanlines: Height/2 aligned to 256 or 16
	 * Total size = align(Y_Stride * Y_Scanlines
	 *          + UV_Stride * UV_Scanlines, 4096)
	 */
@@ -782,6 +799,9 @@ static inline unsigned int VENUS_Y_STRIDE(unsigned int color_fmt,
	switch (color_fmt) {
	case COLOR_FMT_NV12:
	case COLOR_FMT_NV21:
		alignment = NV12_STRIDE_ALIGNMENT;
		stride = MSM_MEDIA_ALIGN(width, alignment);
		break;
	case COLOR_FMT_NV12_512:
		alignment = 512;
		stride = MSM_MEDIA_ALIGN(width, alignment);
@@ -825,6 +845,9 @@ static inline unsigned int VENUS_UV_STRIDE(unsigned int color_fmt,
	switch (color_fmt) {
	case COLOR_FMT_NV21:
	case COLOR_FMT_NV12:
		alignment = NV12_STRIDE_ALIGNMENT;
		stride = MSM_MEDIA_ALIGN(width, alignment);
		break;
	case COLOR_FMT_NV12_512:
		alignment = 512;
		stride = MSM_MEDIA_ALIGN(width, alignment);
@@ -868,6 +891,8 @@ static inline unsigned int VENUS_Y_SCANLINES(unsigned int color_fmt,
	switch (color_fmt) {
	case COLOR_FMT_NV12:
	case COLOR_FMT_NV21:
		alignment = NV12_SCANLINE_ALIGNMENT;
		break;
	case COLOR_FMT_NV12_512:
		alignment = 512;
		break;
@@ -905,6 +930,8 @@ static inline unsigned int VENUS_UV_SCANLINES(unsigned int color_fmt,
	switch (color_fmt) {
	case COLOR_FMT_NV21:
	case COLOR_FMT_NV12:
		alignment = NV12_SCANLINE_ALIGNMENT/2;
		break;
	case COLOR_FMT_NV12_512:
		alignment = 256;
		break;