diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-08-31 10:57:12 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-11 15:00:36 -0400 |
commit | 1697e49a0b8c0ced14015b3f830cdd90c79c75b4 (patch) | |
tree | 1bfb850f592d038565044f762f1fc1886d076fc2 /drivers/media/video | |
parent | 6fd206cb6ebd59e42b376b9e2e8f40d90910757e (diff) |
[media] omap3isp: video: Split format info bpp field into width and bpp
The bpp field currently stores the sample width and is aligned to the
next multiple of 8 bits when computing data size in memory. This won't
work anymore for YUYV8_2X8 formats. Split the bpp field into a sample
width and a bytes per pixel value.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/omap3isp/ispccdc.c | 8 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispvideo.c | 47 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispvideo.h | 6 |
3 files changed, 32 insertions, 29 deletions
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c index 9d7ca9b4c925..4678e2f44973 100644 --- a/drivers/media/video/omap3isp/ispccdc.c +++ b/drivers/media/video/omap3isp/ispccdc.c | |||
@@ -1143,12 +1143,12 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc) | |||
1143 | fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE; | 1143 | fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE; |
1144 | if (!v4l2_subdev_call(sensor, pad, get_fmt, NULL, &fmt_src)) { | 1144 | if (!v4l2_subdev_call(sensor, pad, get_fmt, NULL, &fmt_src)) { |
1145 | fmt_info = omap3isp_video_format_info(fmt_src.format.code); | 1145 | fmt_info = omap3isp_video_format_info(fmt_src.format.code); |
1146 | depth_in = fmt_info->bpp; | 1146 | depth_in = fmt_info->width; |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | fmt_info = omap3isp_video_format_info | 1149 | fmt_info = omap3isp_video_format_info |
1150 | (isp->isp_ccdc.formats[CCDC_PAD_SINK].code); | 1150 | (isp->isp_ccdc.formats[CCDC_PAD_SINK].code); |
1151 | depth_out = fmt_info->bpp; | 1151 | depth_out = fmt_info->width; |
1152 | 1152 | ||
1153 | shift = depth_in - depth_out; | 1153 | shift = depth_in - depth_out; |
1154 | omap3isp_configure_bridge(isp, ccdc->input, pdata, shift); | 1154 | omap3isp_configure_bridge(isp, ccdc->input, pdata, shift); |
@@ -1179,7 +1179,7 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc) | |||
1179 | syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ; | 1179 | syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ; |
1180 | 1180 | ||
1181 | /* Use PACK8 mode for 1byte per pixel formats. */ | 1181 | /* Use PACK8 mode for 1byte per pixel formats. */ |
1182 | if (omap3isp_video_format_info(format->code)->bpp <= 8) | 1182 | if (omap3isp_video_format_info(format->code)->width <= 8) |
1183 | syn_mode |= ISPCCDC_SYN_MODE_PACK8; | 1183 | syn_mode |= ISPCCDC_SYN_MODE_PACK8; |
1184 | else | 1184 | else |
1185 | syn_mode &= ~ISPCCDC_SYN_MODE_PACK8; | 1185 | syn_mode &= ~ISPCCDC_SYN_MODE_PACK8; |
@@ -2182,7 +2182,7 @@ static bool ccdc_is_shiftable(enum v4l2_mbus_pixelcode in, | |||
2182 | if (in_info->flavor != out_info->flavor) | 2182 | if (in_info->flavor != out_info->flavor) |
2183 | return false; | 2183 | return false; |
2184 | 2184 | ||
2185 | return in_info->bpp - out_info->bpp + additional_shift <= 6; | 2185 | return in_info->width - out_info->width + additional_shift <= 6; |
2186 | } | 2186 | } |
2187 | 2187 | ||
2188 | static int ccdc_link_validate(struct v4l2_subdev *sd, | 2188 | static int ccdc_link_validate(struct v4l2_subdev *sd, |
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index b37379d39cdd..6a1137d87789 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c | |||
@@ -53,67 +53,67 @@ | |||
53 | static struct isp_format_info formats[] = { | 53 | static struct isp_format_info formats[] = { |
54 | { V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, | 54 | { V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, |
55 | V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, | 55 | V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, |
56 | V4L2_PIX_FMT_GREY, 8, }, | 56 | V4L2_PIX_FMT_GREY, 8, 1, }, |
57 | { V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y10_1X10, | 57 | { V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y10_1X10, |
58 | V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y8_1X8, | 58 | V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y8_1X8, |
59 | V4L2_PIX_FMT_Y10, 10, }, | 59 | V4L2_PIX_FMT_Y10, 10, 2, }, |
60 | { V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y10_1X10, | 60 | { V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y10_1X10, |
61 | V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y8_1X8, | 61 | V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y8_1X8, |
62 | V4L2_PIX_FMT_Y12, 12, }, | 62 | V4L2_PIX_FMT_Y12, 12, 2, }, |
63 | { V4L2_MBUS_FMT_SBGGR8_1X8, V4L2_MBUS_FMT_SBGGR8_1X8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74 | V4L2_PIX_FMT_SRGGB8, 8, }, | 74 | V4L2_PIX_FMT_SRGGB8, 8, 1, }, |
75 | { V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8, V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8, | 75 | { V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8, V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8, |
76 | V4L2_MBUS_FMT_SBGGR10_1X10, 0, | 76 | V4L2_MBUS_FMT_SBGGR10_1X10, 0, |
77 | V4L2_PIX_FMT_SBGGR10DPCM8, 8, }, | 77 | V4L2_PIX_FMT_SBGGR10DPCM8, 8, 1, }, |
78 | { V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8, V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8, | 78 | { V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8, V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8, |
79 | V4L2_MBUS_FMT_SGBRG10_1X10, 0, | 79 | V4L2_MBUS_FMT_SGBRG10_1X10, 0, |
80 | V4L2_PIX_FMT_SGBRG10DPCM8, 8, }, | 80 | V4L2_PIX_FMT_SGBRG10DPCM8, 8, 1, }, |
81 | { V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, | 81 | { V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, |
82 | V4L2_MBUS_FMT_SGRBG10_1X10, 0, | 82 | V4L2_MBUS_FMT_SGRBG10_1X10, 0, |
83 | V4L2_PIX_FMT_SGRBG10DPCM8, 8, }, | 83 | V4L2_PIX_FMT_SGRBG10DPCM8, 8, 1, }, |
84 | { V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8, V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8, | 84 | { V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8, V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8, |
85 | V4L2_MBUS_FMT_SRGGB10_1X10, 0, | 85 | V4L2_MBUS_FMT_SRGGB10_1X10, 0, |
86 | V4L2_PIX_FMT_SRGGB10DPCM8, 8, }, | 86 | V4L2_PIX_FMT_SRGGB10DPCM8, 8, 1, }, |
87 | { V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10, | 87 | { V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10, |
88 | V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR8_1X8, | 88 | V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR8_1X8, |
89 | V4L2_PIX_FMT_SBGGR10, 10, }, | 89 | V4L2_PIX_FMT_SBGGR10, 10, 2, }, |
90 | { V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG10_1X10, | 90 | { V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG10_1X10, |
91 | V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG8_1X8, | 91 | V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG8_1X8, |
92 | V4L2_PIX_FMT_SGBRG10, 10, }, | 92 | V4L2_PIX_FMT_SGBRG10, 10, 2, }, |
93 | { V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG10_1X10, | 93 | { V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG10_1X10, |
94 | V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG8_1X8, | 94 | V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG8_1X8, |
95 | V4L2_PIX_FMT_SGRBG10, 10, }, | 95 | V4L2_PIX_FMT_SGRBG10, 10, 2, }, |
96 | { V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB10_1X10, | 96 | { V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB10_1X10, |
97 | V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB8_1X8, | 97 | V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB8_1X8, |
98 | V4L2_PIX_FMT_SRGGB10, 10, }, | 98 | V4L2_PIX_FMT_SRGGB10, 10, 2, }, |
99 | { V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR10_1X10, | 99 | { V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR10_1X10, |
100 | V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR8_1X8, | 100 | V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR8_1X8, |
101 | V4L2_PIX_FMT_SBGGR12, 12, }, | 101 | V4L2_PIX_FMT_SBGGR12, 12, 2, }, |
102 | { V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG10_1X10, | 102 | { V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG10_1X10, |
103 | V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG8_1X8, | 103 | V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG8_1X8, |
104 | V4L2_PIX_FMT_SGBRG12, 12, }, | 104 | V4L2_PIX_FMT_SGBRG12, 12, 2, }, |
105 | { V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG10_1X10, | 105 | { V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG10_1X10, |
106 | V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG8_1X8, | 106 | V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG8_1X8, |
107 | V4L2_PIX_FMT_SGRBG12, 12, }, | 107 | V4L2_PIX_FMT_SGRBG12, 12, 2, }, |
108 | { V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB10_1X10, | 108 | { V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB10_1X10, |
109 | V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB8_1X8, | 109 | V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB8_1X8, |
110 | V4L2_PIX_FMT_SRGGB12, 12, }, | 110 | V4L2_PIX_FMT_SRGGB12, 12, 2, }, |
111 | { V4L2_MBUS_FMT_UYVY8_1X16, V4L2_MBUS_FMT_UYVY8_1X16, | 111 | { V4L2_MBUS_FMT_UYVY8_1X16, V4L2_MBUS_FMT_UYVY8_1X16, |
112 | V4L2_MBUS_FMT_UYVY8_1X16, 0, | 112 | V4L2_MBUS_FMT_UYVY8_1X16, 0, |
113 | V4L2_PIX_FMT_UYVY, 16, }, | 113 | V4L2_PIX_FMT_UYVY, 16, 2, }, |
114 | { V4L2_MBUS_FMT_YUYV8_1X16, V4L2_MBUS_FMT_YUYV8_1X16, | 114 | { V4L2_MBUS_FMT_YUYV8_1X16, V4L2_MBUS_FMT_YUYV8_1X16, |
115 | V4L2_MBUS_FMT_YUYV8_1X16, 0, | 115 | V4L2_MBUS_FMT_YUYV8_1X16, 0, |
116 | V4L2_PIX_FMT_YUYV, 16, }, | 116 | V4L2_PIX_FMT_YUYV, 16, 2, }, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | const struct isp_format_info * | 119 | const struct isp_format_info * |
@@ -161,7 +161,7 @@ static unsigned int isp_video_mbus_to_pix(const struct isp_video *video, | |||
161 | if (WARN_ON(i == ARRAY_SIZE(formats))) | 161 | if (WARN_ON(i == ARRAY_SIZE(formats))) |
162 | return 0; | 162 | return 0; |
163 | 163 | ||
164 | min_bpl = pix->width * ALIGN(formats[i].bpp, 8) / 8; | 164 | min_bpl = pix->width * formats[i].bpp; |
165 | 165 | ||
166 | /* Clamp the requested bytes per line value. If the maximum bytes per | 166 | /* Clamp the requested bytes per line value. If the maximum bytes per |
167 | * line value is zero, the module doesn't support user configurable line | 167 | * line value is zero, the module doesn't support user configurable line |
@@ -921,7 +921,8 @@ static int isp_video_check_external_subdevs(struct isp_video *video, | |||
921 | return ret; | 921 | return ret; |
922 | } | 922 | } |
923 | 923 | ||
924 | pipe->external_bpp = omap3isp_video_format_info(fmt.format.code)->bpp; | 924 | pipe->external_width = |
925 | omap3isp_video_format_info(fmt.format.code)->width; | ||
925 | 926 | ||
926 | memset(&ctrls, 0, sizeof(ctrls)); | 927 | memset(&ctrls, 0, sizeof(ctrls)); |
927 | memset(&ctrl, 0, sizeof(ctrl)); | 928 | memset(&ctrl, 0, sizeof(ctrl)); |
diff --git a/drivers/media/video/omap3isp/ispvideo.h b/drivers/media/video/omap3isp/ispvideo.h index 5acc909500ec..1ad470ec2b9d 100644 --- a/drivers/media/video/omap3isp/ispvideo.h +++ b/drivers/media/video/omap3isp/ispvideo.h | |||
@@ -51,7 +51,8 @@ struct v4l2_pix_format; | |||
51 | * @flavor: V4L2 media bus format code for the same pixel layout but | 51 | * @flavor: V4L2 media bus format code for the same pixel layout but |
52 | * shifted to be 8 bits per pixel. =0 if format is not shiftable. | 52 | * shifted to be 8 bits per pixel. =0 if format is not shiftable. |
53 | * @pixelformat: V4L2 pixel format FCC identifier | 53 | * @pixelformat: V4L2 pixel format FCC identifier |
54 | * @bpp: Bits per pixel | 54 | * @width: Bits per pixel (when transferred over a bus) |
55 | * @bpp: Bytes per pixel (when stored in memory) | ||
55 | */ | 56 | */ |
56 | struct isp_format_info { | 57 | struct isp_format_info { |
57 | enum v4l2_mbus_pixelcode code; | 58 | enum v4l2_mbus_pixelcode code; |
@@ -59,6 +60,7 @@ struct isp_format_info { | |||
59 | enum v4l2_mbus_pixelcode uncompressed; | 60 | enum v4l2_mbus_pixelcode uncompressed; |
60 | enum v4l2_mbus_pixelcode flavor; | 61 | enum v4l2_mbus_pixelcode flavor; |
61 | u32 pixelformat; | 62 | u32 pixelformat; |
63 | unsigned int width; | ||
62 | unsigned int bpp; | 64 | unsigned int bpp; |
63 | }; | 65 | }; |
64 | 66 | ||
@@ -106,7 +108,7 @@ struct isp_pipeline { | |||
106 | struct v4l2_fract max_timeperframe; | 108 | struct v4l2_fract max_timeperframe; |
107 | struct v4l2_subdev *external; | 109 | struct v4l2_subdev *external; |
108 | unsigned int external_rate; | 110 | unsigned int external_rate; |
109 | unsigned int external_bpp; | 111 | unsigned int external_width; |
110 | }; | 112 | }; |
111 | 113 | ||
112 | #define to_isp_pipeline(__e) \ | 114 | #define to_isp_pipeline(__e) \ |