From ab19e4e8ca6f84d45bc499a6242d1b795b8d20c3 Mon Sep 17 00:00:00 2001 From: "hyesoo.yu" Date: Mon, 17 Jul 2017 14:22:01 +0900 Subject: [PATCH] [COMMON] g2d: add ABGR2101010 format The bit encoding of ABGR2101010 format in little endian: 31 29 20 19 10 9 0 +--+--------+--------+--------+ | A| B | G | R | +--+--------+--------+--------+ It can be expressed as a bytes sequence as follows: RRRRRRRR GGGGGGRR BBBBGGGG AABBBBBB Change-Id: Ie574e083cc1b4538710e752b1fd3aabdf8d855ea Signed-off-by: hyesoo.yu --- drivers/gpu/exynos/g2d/g2d_command.c | 9 +++++++-- drivers/gpu/exynos/g2d/g2d_format.h | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/exynos/g2d/g2d_command.c b/drivers/gpu/exynos/g2d/g2d_command.c index 47733c564859..882ea8c44891 100644 --- a/drivers/gpu/exynos/g2d/g2d_command.c +++ b/drivers/gpu/exynos/g2d/g2d_command.c @@ -254,6 +254,11 @@ static const struct g2d_fmt g2d_formats[] = { .fmtvalue = G2D_FMT_NV61, .bpp = { 8, 8 }, .num_planes = 2, + }, { + .name = "ABGR2101010", + .fmtvalue = G2D_FMT_ABGR2101010, /* [31:0] ABGR */ + .bpp = { 32 }, + .num_planes = 1, }, }; @@ -387,7 +392,7 @@ static bool check_srccolor_mode(u32 value) { u32 fmt = ((value) & G2D_DATAFMT_MASK) >> G2D_DATAFMT_SHIFT; - if ((fmt > 13) || (fmt == 6) || (fmt == 7) || (fmt == 9)) + if ((fmt > 14) || (fmt == 6) || (fmt == 7) || (fmt == 9)) return false; if (IS_YUV(value) && (value & G2D_DATAFORMAT_AFBC)) @@ -401,7 +406,7 @@ static bool check_dstcolor_mode(u32 value) u32 fmt = ((value) & G2D_DATAFMT_MASK) >> G2D_DATAFMT_SHIFT; /* src + YCbCr420 3p, - YCbCr420 2p 8.2 */ - if ((fmt > 12) || (fmt == 6) || (fmt == 7)) + if ((fmt > 14) || (fmt == 13) || (fmt == 6) || (fmt == 7)) return false; /* AFBC and UORDER shoult not be set together */ diff --git a/drivers/gpu/exynos/g2d/g2d_format.h b/drivers/gpu/exynos/g2d/g2d_format.h index f72ea5d5e9b0..7bffff0a4de0 100644 --- a/drivers/gpu/exynos/g2d/g2d_format.h +++ b/drivers/gpu/exynos/g2d/g2d_format.h @@ -45,6 +45,7 @@ #define G2D_DATAFMT_YUV422SP (11 << G2D_DATAFMT_SHIFT) #define G2D_DATAFMT_P010 (12 << G2D_DATAFMT_SHIFT) #define G2D_DATAFMT_YUV420SP82 (13 << G2D_DATAFMT_SHIFT) +#define G2D_DATAFMT_2101010 (14 << G2D_DATAFMT_SHIFT) #define G2D_FMT_ARGB8888 (G2D_DATAFMT_8888 | G2D_SWZ_ARGB) #define G2D_FMT_ABGR8888 (G2D_DATAFMT_8888 | G2D_SWZ_ABGR) @@ -68,17 +69,20 @@ #define G2D_FMT_NV21_82 (G2D_DATAFMT_YUV420SP82 | G2D_YUV_VU) #define G2D_FMT_NV12_P010 (G2D_DATAFMT_P010 | G2D_YUV_UV) #define G2D_FMT_NV21_P010 (G2D_DATAFMT_P010 | G2D_YUV_VU) +#define G2D_FMT_ABGR2101010 (G2D_DATAFMT_2101010 | G2D_SWZ_ABGR) #define G2D_DATAFORMAT_AFBC (1 << 20) #define G2D_DATAFORMAT_UORDER (1 << 21) #define IS_AFBC(fmt) ((fmt & G2D_DATAFORMAT_AFBC) != 0) #define IS_UORDER(fmt) ((fmt & G2D_DATAFORMAT_UORDER) != 0) -#define IS_YUV(fmt) (((fmt) & G2D_DATAFMT_MASK) > G2D_DATAFMT_RESERVED) +#define IS_YUV(fmt) ((((fmt) & G2D_DATAFMT_MASK) > G2D_DATAFMT_RESERVED) &&\ + (((fmt) & G2D_DATAFMT_MASK) != G2D_DATAFMT_2101010)) #define IS_YUV420(fmt) ((((fmt) >> G2D_DATAFMT_SHIFT) & 0xF) == 0x8) #define IS_YUV422(fmt) ((((fmt) >> G2D_DATAFMT_SHIFT) & 0xE) == 0xA) #define IS_YUV422_2P(fmt) ((((fmt) >> G2D_DATAFMT_SHIFT) & 0xF) == 0xB) -#define IS_RGB(fmt) (((fmt) & G2D_DATAFMT_MASK) < G2D_DATAFMT_8) +#define IS_RGB(fmt) ((((fmt) & G2D_DATAFMT_MASK) < G2D_DATAFMT_8) ||\ + (((fmt) & G2D_DATAFMT_MASK) == G2D_DATAFMT_2101010)) #define IS_YUV420_82(fmt) (((fmt) & G2D_DATAFMT_MASK) == G2D_DATAFMT_YUV420SP82) #define IS_AFBC_WIDTH_ALIGNED(width) IS_ALIGNED((width), 16) -- 2.20.1