]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/msm/mdp: mark if a MDP format is YUV at definition
authorWentao Xu <wentaox@codeaurora.org>
Mon, 6 Jul 2015 20:35:29 +0000 (16:35 -0400)
committerRob Clark <robdclark@gmail.com>
Sat, 15 Aug 2015 22:27:19 +0000 (18:27 -0400)
This makes it easy to determine if a format is YUV. The old
method of using chroma sample type incorrectly marks YUV444 as
RGB format.

Signed-off-by: Wentao Xu <wentaox@codeaurora.org>
[rebase]
Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/mdp/mdp_format.c
drivers/gpu/drm/msm/mdp/mdp_kms.h

index 8263af3d1f8916093ef6b5d32570000f9fb62809..fd803c52692919381fcaff9b6a1710183d2d024c 100644 (file)
@@ -71,7 +71,7 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
        },
 };
 
-#define FMT(name, a, r, g, b, e0, e1, e2, e3, alpha, tight, c, cnt, fp, cs) { \
+#define FMT(name, a, r, g, b, e0, e1, e2, e3, alpha, tight, c, cnt, fp, cs, yuv) { \
                .base = { .pixel_format = DRM_FORMAT_ ## name }, \
                .bpc_a = BPC ## a ## A,                          \
                .bpc_r = BPC ## r,                               \
@@ -83,7 +83,8 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
                .cpp = c,                                        \
                .unpack_count = cnt,                             \
                .fetch_type = fp,                                \
-               .chroma_sample = cs                              \
+               .chroma_sample = cs,                             \
+               .is_yuv = yuv,                                   \
 }
 
 #define BPC0A 0
@@ -95,30 +96,30 @@ static struct csc_cfg csc_convert[CSC_MAX] = {
 static const struct mdp_format formats[] = {
        /*  name      a  r  g  b   e0 e1 e2 e3  alpha   tight  cpp cnt ... */
        FMT(ARGB8888, 8, 8, 8, 8,  1, 0, 2, 3,  true,   true,  4,  4,
-                       MDP_PLANE_INTERLEAVED, CHROMA_FULL),
+                       MDP_PLANE_INTERLEAVED, CHROMA_FULL, false),
        FMT(ABGR8888, 8, 8, 8, 8,  2, 0, 1, 3,  true,   true,  4,  4,
-                       MDP_PLANE_INTERLEAVED, CHROMA_FULL),
+                       MDP_PLANE_INTERLEAVED, CHROMA_FULL, false),
        FMT(RGBA8888, 8, 8, 8, 8,  3, 1, 0, 2,  true,   true,  4,  4,
-                       MDP_PLANE_INTERLEAVED, CHROMA_FULL),
+                       MDP_PLANE_INTERLEAVED, CHROMA_FULL, false),
        FMT(BGRA8888, 8, 8, 8, 8,  3, 2, 0, 1,  true,   true,  4,  4,
-                       MDP_PLANE_INTERLEAVED, CHROMA_FULL),
+                       MDP_PLANE_INTERLEAVED, CHROMA_FULL, false),
        FMT(XRGB8888, 8, 8, 8, 8,  1, 0, 2, 3,  false,  true,  4,  4,
-                       MDP_PLANE_INTERLEAVED, CHROMA_FULL),
+                       MDP_PLANE_INTERLEAVED, CHROMA_FULL, false),
        FMT(RGB888,   0, 8, 8, 8,  1, 0, 2, 0,  false,  true,  3,  3,
-                       MDP_PLANE_INTERLEAVED, CHROMA_FULL),
+                       MDP_PLANE_INTERLEAVED, CHROMA_FULL, false),
        FMT(BGR888,   0, 8, 8, 8,  2, 0, 1, 0,  false,  true,  3,  3,
-                       MDP_PLANE_INTERLEAVED, CHROMA_FULL),
+                       MDP_PLANE_INTERLEAVED, CHROMA_FULL, false),
        FMT(RGB565,   0, 5, 6, 5,  1, 0, 2, 0,  false,  true,  2,  3,
-                       MDP_PLANE_INTERLEAVED, CHROMA_FULL),
+                       MDP_PLANE_INTERLEAVED, CHROMA_FULL, false),
        FMT(BGR565,   0, 5, 6, 5,  2, 0, 1, 0,  false,  true,  2,  3,
-                       MDP_PLANE_INTERLEAVED, CHROMA_FULL),
+                       MDP_PLANE_INTERLEAVED, CHROMA_FULL, false),
 
        /* --- RGB formats above / YUV formats below this line --- */
 
        FMT(NV12,     0, 8, 8, 8,  1, 2, 0, 0,  false,  true,  2, 2,
-                       MDP_PLANE_PSEUDO_PLANAR, CHROMA_420),
+                       MDP_PLANE_PSEUDO_PLANAR, CHROMA_420, true),
        FMT(NV21,     0, 8, 8, 8,  2, 1, 0, 0,  false,  true,  2, 2,
-                       MDP_PLANE_PSEUDO_PLANAR, CHROMA_420),
+                       MDP_PLANE_PSEUDO_PLANAR, CHROMA_420, true),
 };
 
 /*
index 292d6263500038117564903f6cf8ae97358dd6b4..02c6b7fbd61f6b50799961bddf7378d71837d44b 100644 (file)
@@ -90,9 +90,10 @@ struct mdp_format {
        uint8_t cpp, unpack_count;
        enum mdp_fetch_type fetch_type;
        enum mdp_chroma_samp_type chroma_sample;
+       bool is_yuv;
 };
 #define to_mdp_format(x) container_of(x, struct mdp_format, base)
-#define MDP_FORMAT_IS_YUV(mdp_format) ((mdp_format)->chroma_sample > CHROMA_FULL)
+#define MDP_FORMAT_IS_YUV(mdp_format) ((mdp_format)->is_yuv)
 
 uint32_t mdp_get_formats(uint32_t *formats, uint32_t max_formats, bool rgb_only);
 const struct msm_format *mdp_get_format(struct msm_kms *kms, uint32_t format);