diff options
Diffstat (limited to 'drivers/media/platform/omap3isp/isppreview.c')
-rw-r--r-- | drivers/media/platform/omap3isp/isppreview.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c index 691b92a3c3e7..cd8831aebdeb 100644 --- a/drivers/media/platform/omap3isp/isppreview.c +++ b/drivers/media/platform/omap3isp/isppreview.c | |||
@@ -82,8 +82,9 @@ static struct omap3isp_prev_csc flr_prev_csc = { | |||
82 | * The preview engine crops several rows and columns internally depending on | 82 | * The preview engine crops several rows and columns internally depending on |
83 | * which filters are enabled. To avoid format changes when the filters are | 83 | * which filters are enabled. To avoid format changes when the filters are |
84 | * enabled or disabled (which would prevent them from being turned on or off | 84 | * enabled or disabled (which would prevent them from being turned on or off |
85 | * during streaming), the driver assumes all the filters are enabled when | 85 | * during streaming), the driver assumes all filters that can be configured |
86 | * computing sink crop and source format limits. | 86 | * during streaming are enabled when computing sink crop and source format |
87 | * limits. | ||
87 | * | 88 | * |
88 | * If a filter is disabled, additional cropping is automatically added at the | 89 | * If a filter is disabled, additional cropping is automatically added at the |
89 | * preview engine input by the driver to avoid overflow at line and frame end. | 90 | * preview engine input by the driver to avoid overflow at line and frame end. |
@@ -92,25 +93,23 @@ static struct omap3isp_prev_csc flr_prev_csc = { | |||
92 | * Median filter 4 pixels | 93 | * Median filter 4 pixels |
93 | * Noise filter, | 94 | * Noise filter, |
94 | * Faulty pixels correction 4 pixels, 4 lines | 95 | * Faulty pixels correction 4 pixels, 4 lines |
95 | * CFA filter 4 pixels, 4 lines in Bayer mode | ||
96 | * 2 lines in other modes | ||
97 | * Color suppression 2 pixels | 96 | * Color suppression 2 pixels |
98 | * or luma enhancement | 97 | * or luma enhancement |
99 | * ------------------------------------------------------------- | 98 | * ------------------------------------------------------------- |
100 | * Maximum total 14 pixels, 8 lines | 99 | * Maximum total 10 pixels, 4 lines |
101 | * | 100 | * |
102 | * The color suppression and luma enhancement filters are applied after bayer to | 101 | * The color suppression and luma enhancement filters are applied after bayer to |
103 | * YUV conversion. They thus can crop one pixel on the left and one pixel on the | 102 | * YUV conversion. They thus can crop one pixel on the left and one pixel on the |
104 | * right side of the image without changing the color pattern. When both those | 103 | * right side of the image without changing the color pattern. When both those |
105 | * filters are disabled, the driver must crop the two pixels on the same side of | 104 | * filters are disabled, the driver must crop the two pixels on the same side of |
106 | * the image to avoid changing the bayer pattern. The left margin is thus set to | 105 | * the image to avoid changing the bayer pattern. The left margin is thus set to |
107 | * 8 pixels and the right margin to 6 pixels. | 106 | * 6 pixels and the right margin to 4 pixels. |
108 | */ | 107 | */ |
109 | 108 | ||
110 | #define PREV_MARGIN_LEFT 8 | 109 | #define PREV_MARGIN_LEFT 6 |
111 | #define PREV_MARGIN_RIGHT 6 | 110 | #define PREV_MARGIN_RIGHT 4 |
112 | #define PREV_MARGIN_TOP 4 | 111 | #define PREV_MARGIN_TOP 2 |
113 | #define PREV_MARGIN_BOTTOM 4 | 112 | #define PREV_MARGIN_BOTTOM 2 |
114 | 113 | ||
115 | #define PREV_MIN_IN_WIDTH 64 | 114 | #define PREV_MIN_IN_WIDTH 64 |
116 | #define PREV_MIN_IN_HEIGHT 8 | 115 | #define PREV_MIN_IN_HEIGHT 8 |
@@ -1080,7 +1079,6 @@ static void preview_config_input_format(struct isp_prev_device *prev, | |||
1080 | */ | 1079 | */ |
1081 | static void preview_config_input_size(struct isp_prev_device *prev, u32 active) | 1080 | static void preview_config_input_size(struct isp_prev_device *prev, u32 active) |
1082 | { | 1081 | { |
1083 | const struct v4l2_mbus_framefmt *format = &prev->formats[PREV_PAD_SINK]; | ||
1084 | struct isp_device *isp = to_isp_device(prev); | 1082 | struct isp_device *isp = to_isp_device(prev); |
1085 | unsigned int sph = prev->crop.left; | 1083 | unsigned int sph = prev->crop.left; |
1086 | unsigned int eph = prev->crop.left + prev->crop.width - 1; | 1084 | unsigned int eph = prev->crop.left + prev->crop.width - 1; |
@@ -1088,14 +1086,6 @@ static void preview_config_input_size(struct isp_prev_device *prev, u32 active) | |||
1088 | unsigned int elv = prev->crop.top + prev->crop.height - 1; | 1086 | unsigned int elv = prev->crop.top + prev->crop.height - 1; |
1089 | u32 features; | 1087 | u32 features; |
1090 | 1088 | ||
1091 | if (format->code != V4L2_MBUS_FMT_Y8_1X8 && | ||
1092 | format->code != V4L2_MBUS_FMT_Y10_1X10) { | ||
1093 | sph -= 2; | ||
1094 | eph += 2; | ||
1095 | slv -= 2; | ||
1096 | elv += 2; | ||
1097 | } | ||
1098 | |||
1099 | features = (prev->params.params[0].features & active) | 1089 | features = (prev->params.params[0].features & active) |
1100 | | (prev->params.params[1].features & ~active); | 1090 | | (prev->params.params[1].features & ~active); |
1101 | 1091 | ||
@@ -1849,6 +1839,18 @@ static void preview_try_crop(struct isp_prev_device *prev, | |||
1849 | right -= 2; | 1839 | right -= 2; |
1850 | } | 1840 | } |
1851 | 1841 | ||
1842 | /* The CFA filter crops 4 lines and 4 columns in Bayer mode, and 2 lines | ||
1843 | * and no columns in other modes. Increase the margins based on the sink | ||
1844 | * format. | ||
1845 | */ | ||
1846 | if (sink->code != V4L2_MBUS_FMT_Y8_1X8 && | ||
1847 | sink->code != V4L2_MBUS_FMT_Y10_1X10) { | ||
1848 | left += 2; | ||
1849 | right -= 2; | ||
1850 | top += 2; | ||
1851 | bottom -= 2; | ||
1852 | } | ||
1853 | |||
1852 | /* Restrict left/top to even values to keep the Bayer pattern. */ | 1854 | /* Restrict left/top to even values to keep the Bayer pattern. */ |
1853 | crop->left &= ~1; | 1855 | crop->left &= ~1; |
1854 | crop->top &= ~1; | 1856 | crop->top &= ~1; |