aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/ti-vpe
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2013-12-12 03:36:04 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-07 03:58:02 -0500
commitb4fcdaf7654f9506f80d4e3f2b045a78333d62dc (patch)
treea6caff1514b4776ad84c0295dcdcf1937c70612d /drivers/media/platform/ti-vpe
parent30496799b07137654d2892270d063a4559acff3d (diff)
[media] v4l: ti-vpe: Add a type specifier to describe vpdma data format type
The struct vpdma_data_format holds the color format depth and the data_type value needed to be programmed in the data descriptors. However, it doesn't tell what type of color format is it, i.e, whether it is RGB, YUV or Misc. This information is needed when by vpdma library when forming descriptors. We modify the depth parameter for the chroma portion of the NV12 format. For this, we check if the data_type value is C420. This isn't sufficient as there are many YUV and RGB vpdma formats which have the same data_type value. Hence, we need to hold the type of the color format for the above case, and possibly more cases in the future. Signed-off-by: Archit Taneja <archit@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/ti-vpe')
-rw-r--r--drivers/media/platform/ti-vpe/vpdma.c36
-rw-r--r--drivers/media/platform/ti-vpe/vpdma.h7
2 files changed, 41 insertions, 2 deletions
diff --git a/drivers/media/platform/ti-vpe/vpdma.c b/drivers/media/platform/ti-vpe/vpdma.c
index f97253f6699f..a268f680ed1b 100644
--- a/drivers/media/platform/ti-vpe/vpdma.c
+++ b/drivers/media/platform/ti-vpe/vpdma.c
@@ -30,38 +30,47 @@
30 30
31const struct vpdma_data_format vpdma_yuv_fmts[] = { 31const struct vpdma_data_format vpdma_yuv_fmts[] = {
32 [VPDMA_DATA_FMT_Y444] = { 32 [VPDMA_DATA_FMT_Y444] = {
33 .type = VPDMA_DATA_FMT_TYPE_YUV,
33 .data_type = DATA_TYPE_Y444, 34 .data_type = DATA_TYPE_Y444,
34 .depth = 8, 35 .depth = 8,
35 }, 36 },
36 [VPDMA_DATA_FMT_Y422] = { 37 [VPDMA_DATA_FMT_Y422] = {
38 .type = VPDMA_DATA_FMT_TYPE_YUV,
37 .data_type = DATA_TYPE_Y422, 39 .data_type = DATA_TYPE_Y422,
38 .depth = 8, 40 .depth = 8,
39 }, 41 },
40 [VPDMA_DATA_FMT_Y420] = { 42 [VPDMA_DATA_FMT_Y420] = {
43 .type = VPDMA_DATA_FMT_TYPE_YUV,
41 .data_type = DATA_TYPE_Y420, 44 .data_type = DATA_TYPE_Y420,
42 .depth = 8, 45 .depth = 8,
43 }, 46 },
44 [VPDMA_DATA_FMT_C444] = { 47 [VPDMA_DATA_FMT_C444] = {
48 .type = VPDMA_DATA_FMT_TYPE_YUV,
45 .data_type = DATA_TYPE_C444, 49 .data_type = DATA_TYPE_C444,
46 .depth = 8, 50 .depth = 8,
47 }, 51 },
48 [VPDMA_DATA_FMT_C422] = { 52 [VPDMA_DATA_FMT_C422] = {
53 .type = VPDMA_DATA_FMT_TYPE_YUV,
49 .data_type = DATA_TYPE_C422, 54 .data_type = DATA_TYPE_C422,
50 .depth = 8, 55 .depth = 8,
51 }, 56 },
52 [VPDMA_DATA_FMT_C420] = { 57 [VPDMA_DATA_FMT_C420] = {
58 .type = VPDMA_DATA_FMT_TYPE_YUV,
53 .data_type = DATA_TYPE_C420, 59 .data_type = DATA_TYPE_C420,
54 .depth = 4, 60 .depth = 4,
55 }, 61 },
56 [VPDMA_DATA_FMT_YC422] = { 62 [VPDMA_DATA_FMT_YC422] = {
63 .type = VPDMA_DATA_FMT_TYPE_YUV,
57 .data_type = DATA_TYPE_YC422, 64 .data_type = DATA_TYPE_YC422,
58 .depth = 16, 65 .depth = 16,
59 }, 66 },
60 [VPDMA_DATA_FMT_YC444] = { 67 [VPDMA_DATA_FMT_YC444] = {
68 .type = VPDMA_DATA_FMT_TYPE_YUV,
61 .data_type = DATA_TYPE_YC444, 69 .data_type = DATA_TYPE_YC444,
62 .depth = 24, 70 .depth = 24,
63 }, 71 },
64 [VPDMA_DATA_FMT_CY422] = { 72 [VPDMA_DATA_FMT_CY422] = {
73 .type = VPDMA_DATA_FMT_TYPE_YUV,
65 .data_type = DATA_TYPE_CY422, 74 .data_type = DATA_TYPE_CY422,
66 .depth = 16, 75 .depth = 16,
67 }, 76 },
@@ -69,82 +78,102 @@ const struct vpdma_data_format vpdma_yuv_fmts[] = {
69 78
70const struct vpdma_data_format vpdma_rgb_fmts[] = { 79const struct vpdma_data_format vpdma_rgb_fmts[] = {
71 [VPDMA_DATA_FMT_RGB565] = { 80 [VPDMA_DATA_FMT_RGB565] = {
81 .type = VPDMA_DATA_FMT_TYPE_RGB,
72 .data_type = DATA_TYPE_RGB16_565, 82 .data_type = DATA_TYPE_RGB16_565,
73 .depth = 16, 83 .depth = 16,
74 }, 84 },
75 [VPDMA_DATA_FMT_ARGB16_1555] = { 85 [VPDMA_DATA_FMT_ARGB16_1555] = {
86 .type = VPDMA_DATA_FMT_TYPE_RGB,
76 .data_type = DATA_TYPE_ARGB_1555, 87 .data_type = DATA_TYPE_ARGB_1555,
77 .depth = 16, 88 .depth = 16,
78 }, 89 },
79 [VPDMA_DATA_FMT_ARGB16] = { 90 [VPDMA_DATA_FMT_ARGB16] = {
91 .type = VPDMA_DATA_FMT_TYPE_RGB,
80 .data_type = DATA_TYPE_ARGB_4444, 92 .data_type = DATA_TYPE_ARGB_4444,
81 .depth = 16, 93 .depth = 16,
82 }, 94 },
83 [VPDMA_DATA_FMT_RGBA16_5551] = { 95 [VPDMA_DATA_FMT_RGBA16_5551] = {
96 .type = VPDMA_DATA_FMT_TYPE_RGB,
84 .data_type = DATA_TYPE_RGBA_5551, 97 .data_type = DATA_TYPE_RGBA_5551,
85 .depth = 16, 98 .depth = 16,
86 }, 99 },
87 [VPDMA_DATA_FMT_RGBA16] = { 100 [VPDMA_DATA_FMT_RGBA16] = {
101 .type = VPDMA_DATA_FMT_TYPE_RGB,
88 .data_type = DATA_TYPE_RGBA_4444, 102 .data_type = DATA_TYPE_RGBA_4444,
89 .depth = 16, 103 .depth = 16,
90 }, 104 },
91 [VPDMA_DATA_FMT_ARGB24] = { 105 [VPDMA_DATA_FMT_ARGB24] = {
106 .type = VPDMA_DATA_FMT_TYPE_RGB,
92 .data_type = DATA_TYPE_ARGB24_6666, 107 .data_type = DATA_TYPE_ARGB24_6666,
93 .depth = 24, 108 .depth = 24,
94 }, 109 },
95 [VPDMA_DATA_FMT_RGB24] = { 110 [VPDMA_DATA_FMT_RGB24] = {
111 .type = VPDMA_DATA_FMT_TYPE_RGB,
96 .data_type = DATA_TYPE_RGB24_888, 112 .data_type = DATA_TYPE_RGB24_888,
97 .depth = 24, 113 .depth = 24,
98 }, 114 },
99 [VPDMA_DATA_FMT_ARGB32] = { 115 [VPDMA_DATA_FMT_ARGB32] = {
116 .type = VPDMA_DATA_FMT_TYPE_RGB,
100 .data_type = DATA_TYPE_ARGB32_8888, 117 .data_type = DATA_TYPE_ARGB32_8888,
101 .depth = 32, 118 .depth = 32,
102 }, 119 },
103 [VPDMA_DATA_FMT_RGBA24] = { 120 [VPDMA_DATA_FMT_RGBA24] = {
121 .type = VPDMA_DATA_FMT_TYPE_RGB,
104 .data_type = DATA_TYPE_RGBA24_6666, 122 .data_type = DATA_TYPE_RGBA24_6666,
105 .depth = 24, 123 .depth = 24,
106 }, 124 },
107 [VPDMA_DATA_FMT_RGBA32] = { 125 [VPDMA_DATA_FMT_RGBA32] = {
126 .type = VPDMA_DATA_FMT_TYPE_RGB,
108 .data_type = DATA_TYPE_RGBA32_8888, 127 .data_type = DATA_TYPE_RGBA32_8888,
109 .depth = 32, 128 .depth = 32,
110 }, 129 },
111 [VPDMA_DATA_FMT_BGR565] = { 130 [VPDMA_DATA_FMT_BGR565] = {
131 .type = VPDMA_DATA_FMT_TYPE_RGB,
112 .data_type = DATA_TYPE_BGR16_565, 132 .data_type = DATA_TYPE_BGR16_565,
113 .depth = 16, 133 .depth = 16,
114 }, 134 },
115 [VPDMA_DATA_FMT_ABGR16_1555] = { 135 [VPDMA_DATA_FMT_ABGR16_1555] = {
136 .type = VPDMA_DATA_FMT_TYPE_RGB,
116 .data_type = DATA_TYPE_ABGR_1555, 137 .data_type = DATA_TYPE_ABGR_1555,
117 .depth = 16, 138 .depth = 16,
118 }, 139 },
119 [VPDMA_DATA_FMT_ABGR16] = { 140 [VPDMA_DATA_FMT_ABGR16] = {
141 .type = VPDMA_DATA_FMT_TYPE_RGB,
120 .data_type = DATA_TYPE_ABGR_4444, 142 .data_type = DATA_TYPE_ABGR_4444,
121 .depth = 16, 143 .depth = 16,
122 }, 144 },
123 [VPDMA_DATA_FMT_BGRA16_5551] = { 145 [VPDMA_DATA_FMT_BGRA16_5551] = {
146 .type = VPDMA_DATA_FMT_TYPE_RGB,
124 .data_type = DATA_TYPE_BGRA_5551, 147 .data_type = DATA_TYPE_BGRA_5551,
125 .depth = 16, 148 .depth = 16,
126 }, 149 },
127 [VPDMA_DATA_FMT_BGRA16] = { 150 [VPDMA_DATA_FMT_BGRA16] = {
151 .type = VPDMA_DATA_FMT_TYPE_RGB,
128 .data_type = DATA_TYPE_BGRA_4444, 152 .data_type = DATA_TYPE_BGRA_4444,
129 .depth = 16, 153 .depth = 16,
130 }, 154 },
131 [VPDMA_DATA_FMT_ABGR24] = { 155 [VPDMA_DATA_FMT_ABGR24] = {
156 .type = VPDMA_DATA_FMT_TYPE_RGB,
132 .data_type = DATA_TYPE_ABGR24_6666, 157 .data_type = DATA_TYPE_ABGR24_6666,
133 .depth = 24, 158 .depth = 24,
134 }, 159 },
135 [VPDMA_DATA_FMT_BGR24] = { 160 [VPDMA_DATA_FMT_BGR24] = {
161 .type = VPDMA_DATA_FMT_TYPE_RGB,
136 .data_type = DATA_TYPE_BGR24_888, 162 .data_type = DATA_TYPE_BGR24_888,
137 .depth = 24, 163 .depth = 24,
138 }, 164 },
139 [VPDMA_DATA_FMT_ABGR32] = { 165 [VPDMA_DATA_FMT_ABGR32] = {
166 .type = VPDMA_DATA_FMT_TYPE_RGB,
140 .data_type = DATA_TYPE_ABGR32_8888, 167 .data_type = DATA_TYPE_ABGR32_8888,
141 .depth = 32, 168 .depth = 32,
142 }, 169 },
143 [VPDMA_DATA_FMT_BGRA24] = { 170 [VPDMA_DATA_FMT_BGRA24] = {
171 .type = VPDMA_DATA_FMT_TYPE_RGB,
144 .data_type = DATA_TYPE_BGRA24_6666, 172 .data_type = DATA_TYPE_BGRA24_6666,
145 .depth = 24, 173 .depth = 24,
146 }, 174 },
147 [VPDMA_DATA_FMT_BGRA32] = { 175 [VPDMA_DATA_FMT_BGRA32] = {
176 .type = VPDMA_DATA_FMT_TYPE_RGB,
148 .data_type = DATA_TYPE_BGRA32_8888, 177 .data_type = DATA_TYPE_BGRA32_8888,
149 .depth = 32, 178 .depth = 32,
150 }, 179 },
@@ -152,6 +181,7 @@ const struct vpdma_data_format vpdma_rgb_fmts[] = {
152 181
153const struct vpdma_data_format vpdma_misc_fmts[] = { 182const struct vpdma_data_format vpdma_misc_fmts[] = {
154 [VPDMA_DATA_FMT_MV] = { 183 [VPDMA_DATA_FMT_MV] = {
184 .type = VPDMA_DATA_FMT_TYPE_MISC,
155 .data_type = DATA_TYPE_MV, 185 .data_type = DATA_TYPE_MV,
156 .depth = 4, 186 .depth = 4,
157 }, 187 },
@@ -599,7 +629,8 @@ void vpdma_add_out_dtd(struct vpdma_desc_list *list, struct v4l2_rect *c_rect,
599 629
600 channel = next_chan = chan_info[chan].num; 630 channel = next_chan = chan_info[chan].num;
601 631
602 if (fmt->data_type == DATA_TYPE_C420) 632 if (fmt->type == VPDMA_DATA_FMT_TYPE_YUV &&
633 fmt->data_type == DATA_TYPE_C420)
603 depth = 8; 634 depth = 8;
604 635
605 stride = ALIGN((depth * c_rect->width) >> 3, VPDMA_STRIDE_ALIGN); 636 stride = ALIGN((depth * c_rect->width) >> 3, VPDMA_STRIDE_ALIGN);
@@ -649,7 +680,8 @@ void vpdma_add_in_dtd(struct vpdma_desc_list *list, int frame_width,
649 680
650 channel = next_chan = chan_info[chan].num; 681 channel = next_chan = chan_info[chan].num;
651 682
652 if (fmt->data_type == DATA_TYPE_C420) { 683 if (fmt->type == VPDMA_DATA_FMT_TYPE_YUV &&
684 fmt->data_type == DATA_TYPE_C420) {
653 height >>= 1; 685 height >>= 1;
654 frame_height >>= 1; 686 frame_height >>= 1;
655 depth = 8; 687 depth = 8;
diff --git a/drivers/media/platform/ti-vpe/vpdma.h b/drivers/media/platform/ti-vpe/vpdma.h
index 62dd14305e81..cf40f11b3c8f 100644
--- a/drivers/media/platform/ti-vpe/vpdma.h
+++ b/drivers/media/platform/ti-vpe/vpdma.h
@@ -39,7 +39,14 @@ struct vpdma_data {
39 bool ready; 39 bool ready;
40}; 40};
41 41
42enum vpdma_data_format_type {
43 VPDMA_DATA_FMT_TYPE_YUV,
44 VPDMA_DATA_FMT_TYPE_RGB,
45 VPDMA_DATA_FMT_TYPE_MISC,
46};
47
42struct vpdma_data_format { 48struct vpdma_data_format {
49 enum vpdma_data_format_type type;
43 int data_type; 50 int data_type;
44 u8 depth; 51 u8 depth;
45}; 52};