Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Archit Taneja and committed by
Mauro Carvalho Chehab
b4fcdaf7 30496799

+41 -2
+34 -2
drivers/media/platform/ti-vpe/vpdma.c
··· 30 30 31 31 const struct vpdma_data_format vpdma_yuv_fmts[] = { 32 32 [VPDMA_DATA_FMT_Y444] = { 33 + .type = VPDMA_DATA_FMT_TYPE_YUV, 33 34 .data_type = DATA_TYPE_Y444, 34 35 .depth = 8, 35 36 }, 36 37 [VPDMA_DATA_FMT_Y422] = { 38 + .type = VPDMA_DATA_FMT_TYPE_YUV, 37 39 .data_type = DATA_TYPE_Y422, 38 40 .depth = 8, 39 41 }, 40 42 [VPDMA_DATA_FMT_Y420] = { 43 + .type = VPDMA_DATA_FMT_TYPE_YUV, 41 44 .data_type = DATA_TYPE_Y420, 42 45 .depth = 8, 43 46 }, 44 47 [VPDMA_DATA_FMT_C444] = { 48 + .type = VPDMA_DATA_FMT_TYPE_YUV, 45 49 .data_type = DATA_TYPE_C444, 46 50 .depth = 8, 47 51 }, 48 52 [VPDMA_DATA_FMT_C422] = { 53 + .type = VPDMA_DATA_FMT_TYPE_YUV, 49 54 .data_type = DATA_TYPE_C422, 50 55 .depth = 8, 51 56 }, 52 57 [VPDMA_DATA_FMT_C420] = { 58 + .type = VPDMA_DATA_FMT_TYPE_YUV, 53 59 .data_type = DATA_TYPE_C420, 54 60 .depth = 4, 55 61 }, 56 62 [VPDMA_DATA_FMT_YC422] = { 63 + .type = VPDMA_DATA_FMT_TYPE_YUV, 57 64 .data_type = DATA_TYPE_YC422, 58 65 .depth = 16, 59 66 }, 60 67 [VPDMA_DATA_FMT_YC444] = { 68 + .type = VPDMA_DATA_FMT_TYPE_YUV, 61 69 .data_type = DATA_TYPE_YC444, 62 70 .depth = 24, 63 71 }, 64 72 [VPDMA_DATA_FMT_CY422] = { 73 + .type = VPDMA_DATA_FMT_TYPE_YUV, 65 74 .data_type = DATA_TYPE_CY422, 66 75 .depth = 16, 67 76 }, ··· 78 69 79 70 const struct vpdma_data_format vpdma_rgb_fmts[] = { 80 71 [VPDMA_DATA_FMT_RGB565] = { 72 + .type = VPDMA_DATA_FMT_TYPE_RGB, 81 73 .data_type = DATA_TYPE_RGB16_565, 82 74 .depth = 16, 83 75 }, 84 76 [VPDMA_DATA_FMT_ARGB16_1555] = { 77 + .type = VPDMA_DATA_FMT_TYPE_RGB, 85 78 .data_type = DATA_TYPE_ARGB_1555, 86 79 .depth = 16, 87 80 }, 88 81 [VPDMA_DATA_FMT_ARGB16] = { 82 + .type = VPDMA_DATA_FMT_TYPE_RGB, 89 83 .data_type = DATA_TYPE_ARGB_4444, 90 84 .depth = 16, 91 85 }, 92 86 [VPDMA_DATA_FMT_RGBA16_5551] = { 87 + .type = VPDMA_DATA_FMT_TYPE_RGB, 93 88 .data_type = DATA_TYPE_RGBA_5551, 94 89 .depth = 16, 95 90 }, 96 91 [VPDMA_DATA_FMT_RGBA16] = { 92 + .type = VPDMA_DATA_FMT_TYPE_RGB, 97 93 .data_type = DATA_TYPE_RGBA_4444, 98 94 .depth = 16, 99 95 }, 100 96 [VPDMA_DATA_FMT_ARGB24] = { 97 + .type = VPDMA_DATA_FMT_TYPE_RGB, 101 98 .data_type = DATA_TYPE_ARGB24_6666, 102 99 .depth = 24, 103 100 }, 104 101 [VPDMA_DATA_FMT_RGB24] = { 102 + .type = VPDMA_DATA_FMT_TYPE_RGB, 105 103 .data_type = DATA_TYPE_RGB24_888, 106 104 .depth = 24, 107 105 }, 108 106 [VPDMA_DATA_FMT_ARGB32] = { 107 + .type = VPDMA_DATA_FMT_TYPE_RGB, 109 108 .data_type = DATA_TYPE_ARGB32_8888, 110 109 .depth = 32, 111 110 }, 112 111 [VPDMA_DATA_FMT_RGBA24] = { 112 + .type = VPDMA_DATA_FMT_TYPE_RGB, 113 113 .data_type = DATA_TYPE_RGBA24_6666, 114 114 .depth = 24, 115 115 }, 116 116 [VPDMA_DATA_FMT_RGBA32] = { 117 + .type = VPDMA_DATA_FMT_TYPE_RGB, 117 118 .data_type = DATA_TYPE_RGBA32_8888, 118 119 .depth = 32, 119 120 }, 120 121 [VPDMA_DATA_FMT_BGR565] = { 122 + .type = VPDMA_DATA_FMT_TYPE_RGB, 121 123 .data_type = DATA_TYPE_BGR16_565, 122 124 .depth = 16, 123 125 }, 124 126 [VPDMA_DATA_FMT_ABGR16_1555] = { 127 + .type = VPDMA_DATA_FMT_TYPE_RGB, 125 128 .data_type = DATA_TYPE_ABGR_1555, 126 129 .depth = 16, 127 130 }, 128 131 [VPDMA_DATA_FMT_ABGR16] = { 132 + .type = VPDMA_DATA_FMT_TYPE_RGB, 129 133 .data_type = DATA_TYPE_ABGR_4444, 130 134 .depth = 16, 131 135 }, 132 136 [VPDMA_DATA_FMT_BGRA16_5551] = { 137 + .type = VPDMA_DATA_FMT_TYPE_RGB, 133 138 .data_type = DATA_TYPE_BGRA_5551, 134 139 .depth = 16, 135 140 }, 136 141 [VPDMA_DATA_FMT_BGRA16] = { 142 + .type = VPDMA_DATA_FMT_TYPE_RGB, 137 143 .data_type = DATA_TYPE_BGRA_4444, 138 144 .depth = 16, 139 145 }, 140 146 [VPDMA_DATA_FMT_ABGR24] = { 147 + .type = VPDMA_DATA_FMT_TYPE_RGB, 141 148 .data_type = DATA_TYPE_ABGR24_6666, 142 149 .depth = 24, 143 150 }, 144 151 [VPDMA_DATA_FMT_BGR24] = { 152 + .type = VPDMA_DATA_FMT_TYPE_RGB, 145 153 .data_type = DATA_TYPE_BGR24_888, 146 154 .depth = 24, 147 155 }, 148 156 [VPDMA_DATA_FMT_ABGR32] = { 157 + .type = VPDMA_DATA_FMT_TYPE_RGB, 149 158 .data_type = DATA_TYPE_ABGR32_8888, 150 159 .depth = 32, 151 160 }, 152 161 [VPDMA_DATA_FMT_BGRA24] = { 162 + .type = VPDMA_DATA_FMT_TYPE_RGB, 153 163 .data_type = DATA_TYPE_BGRA24_6666, 154 164 .depth = 24, 155 165 }, 156 166 [VPDMA_DATA_FMT_BGRA32] = { 167 + .type = VPDMA_DATA_FMT_TYPE_RGB, 157 168 .data_type = DATA_TYPE_BGRA32_8888, 158 169 .depth = 32, 159 170 }, ··· 181 152 182 153 const struct vpdma_data_format vpdma_misc_fmts[] = { 183 154 [VPDMA_DATA_FMT_MV] = { 155 + .type = VPDMA_DATA_FMT_TYPE_MISC, 184 156 .data_type = DATA_TYPE_MV, 185 157 .depth = 4, 186 158 }, ··· 629 599 630 600 channel = next_chan = chan_info[chan].num; 631 601 632 - if (fmt->data_type == DATA_TYPE_C420) 602 + if (fmt->type == VPDMA_DATA_FMT_TYPE_YUV && 603 + fmt->data_type == DATA_TYPE_C420) 633 604 depth = 8; 634 605 635 606 stride = ALIGN((depth * c_rect->width) >> 3, VPDMA_STRIDE_ALIGN); ··· 680 649 681 650 channel = next_chan = chan_info[chan].num; 682 651 683 - if (fmt->data_type == DATA_TYPE_C420) { 652 + if (fmt->type == VPDMA_DATA_FMT_TYPE_YUV && 653 + fmt->data_type == DATA_TYPE_C420) { 684 654 height >>= 1; 685 655 frame_height >>= 1; 686 656 depth = 8;
+7
drivers/media/platform/ti-vpe/vpdma.h
··· 39 39 bool ready; 40 40 }; 41 41 42 + enum vpdma_data_format_type { 43 + VPDMA_DATA_FMT_TYPE_YUV, 44 + VPDMA_DATA_FMT_TYPE_RGB, 45 + VPDMA_DATA_FMT_TYPE_MISC, 46 + }; 47 + 42 48 struct vpdma_data_format { 49 + enum vpdma_data_format_type type; 43 50 int data_type; 44 51 u8 depth; 45 52 };