diff options
Diffstat (limited to 'drivers/gpu/ipu-v3/ipu-image-convert.c')
| -rw-r--r-- | drivers/gpu/ipu-v3/ipu-image-convert.c | 63 |
1 files changed, 7 insertions, 56 deletions
diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index af1612044eef..3c33b4defab5 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -7,7 +7,10 @@ #include <linux/interrupt.h> #include <linux/dma-mapping.h> +#include <linux/math.h> + #include <video/imx-ipu-image-convert.h> + #include "ipu-prv.h" /* @@ -352,20 +355,6 @@ static void dump_format(struct ipu_image_convert_ctx *ctx, (ic_image->fmt->fourcc >> 24) & 0xff); } -int ipu_image_convert_enum_format(int index, u32 *fourcc) -{ - const struct ipu_image_pixfmt *fmt; - - if (index >= (int)ARRAY_SIZE(image_convert_formats)) - return -EINVAL; - - /* Format found */ - fmt = &image_convert_formats[index]; - *fourcc = fmt->fourcc; - return 0; -} -EXPORT_SYMBOL_GPL(ipu_image_convert_enum_format); - static void free_dma_buf(struct ipu_image_convert_priv *priv, struct ipu_image_convert_dma_buf *buf) { @@ -543,7 +532,7 @@ static void find_best_seam(struct ipu_image_convert_ctx *ctx, unsigned int in_pos; unsigned int in_pos_aligned; unsigned int in_pos_rounded; - unsigned int abs_diff; + unsigned int diff; /* * Tiles in the right row / bottom column may not be allowed to @@ -575,15 +564,11 @@ static void find_best_seam(struct ipu_image_convert_ctx *ctx, (in_edge - in_pos_rounded) % in_burst) continue; - if (in_pos < in_pos_aligned) - abs_diff = in_pos_aligned - in_pos; - else - abs_diff = in_pos - in_pos_aligned; - - if (abs_diff < min_diff) { + diff = abs_diff(in_pos, in_pos_aligned); + if (diff < min_diff) { in_seam = in_pos_rounded; out_seam = out_pos; - min_diff = abs_diff; + min_diff = diff; } } @@ -2438,40 +2423,6 @@ ipu_image_convert(struct ipu_soc *ipu, enum ipu_ic_task ic_task, } EXPORT_SYMBOL_GPL(ipu_image_convert); -/* "Canned" synchronous single image conversion */ -static void image_convert_sync_complete(struct ipu_image_convert_run *run, - void *data) -{ - struct completion *comp = data; - - complete(comp); -} - -int ipu_image_convert_sync(struct ipu_soc *ipu, enum ipu_ic_task ic_task, - struct ipu_image *in, struct ipu_image *out, - enum ipu_rotate_mode rot_mode) -{ - struct ipu_image_convert_run *run; - struct completion comp; - int ret; - - init_completion(&comp); - - run = ipu_image_convert(ipu, ic_task, in, out, rot_mode, - image_convert_sync_complete, &comp); - if (IS_ERR(run)) - return PTR_ERR(run); - - ret = wait_for_completion_timeout(&comp, msecs_to_jiffies(10000)); - ret = (ret == 0) ? -ETIMEDOUT : 0; - - ipu_image_convert_unprepare(run->ctx); - kfree(run); - - return ret; -} -EXPORT_SYMBOL_GPL(ipu_image_convert_sync); - int ipu_image_convert_init(struct ipu_soc *ipu, struct device *dev) { struct ipu_image_convert_priv *priv; |
