Skip to content

Commit cd98e85

Browse files
slongerbeampH5
authored andcommitted
gpu: ipu-v3: Add queued image conversion support
This patch implements image conversion support using the IC tasks, with tiling to support scaling to and from images up to 4096x4096. Image rotation is also supported. Image conversion requests are added to a run queue under the IC tasks. The internal API is subsystem agnostic (no V4L2 dependency except for the use of V4L2 fourcc pixel formats). Callers prepare for image conversion by calling ipu_image_convert_prepare(), which initializes the parameters of the conversion. The caller passes in the ipu and IC task to use for the conversion, the input and output image formats, a rotation mode, and a completion callback and completion context pointer: struct ipu_image_converter_ctx * ipu_image_convert_prepare(struct ipu_soc *ipu, enum ipu_ic_task ic_task, struct ipu_image *in, struct ipu_image *out, enum ipu_rotate_mode rot_mode, ipu_image_converter_cb_t complete, void *complete_context); A new conversion context is created that is added to an IC task context queue. The caller is given the new conversion context, which can then be passed to the further APIs: int ipu_image_convert_queue(struct ipu_image_converter_run *run); This queues the given image conversion request run to a run queue, and starts the conversion immediately if the run queue is empty. Only the physaddr's of the input and output image buffers are needed, since the conversion context was created previously with ipu_image_convert_prepare(). When the conversion completes, the run pointer is returned to the completion callback. void ipu_image_convert_abort(struct ipu_image_converter_ctx *ctx); This will abort any active or pending conversions for this context. Any currently active or pending runs belonging to this context are returned via the completion callback with an error status. void ipu_image_convert_unprepare(struct ipu_image_converter_ctx *ctx); Unprepares the conversion context. Any active or pending runs will be aborted by calling ipu_image_convert_abort(). Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
1 parent 8b9c3d5 commit cd98e85

5 files changed

Lines changed: 1932 additions & 1 deletion

File tree

‎drivers/gpu/ipu-v3/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
obj-$(CONFIG_IMX_IPUV3_CORE) += imx-ipu-v3.o
22

33
imx-ipu-v3-objs := ipu-common.o ipu-cpmem.o ipu-csi.o ipu-dc.o ipu-di.o \
4-
ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-smfc.o ipu-vdi.o
4+
ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-image-convert.o \
5+
ipu-smfc.o ipu-vdi.o

‎drivers/gpu/ipu-v3/ipu-common.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,12 @@ static int ipu_submodules_init(struct ipu_soc *ipu,
978978
goto err_vdi;
979979
}
980980

981+
ret = ipu_image_convert_init(ipu, dev);
982+
if (ret) {
983+
unit = "image_convert";
984+
goto err_image_convert;
985+
}
986+
981987
ret = ipu_di_init(ipu, dev, 0, ipu_base + devtype->disp0_ofs,
982988
IPU_CONF_DI0_EN, ipu_clk);
983989
if (ret) {
@@ -1032,6 +1038,8 @@ static int ipu_submodules_init(struct ipu_soc *ipu,
10321038
err_di_1:
10331039
ipu_di_exit(ipu, 0);
10341040
err_di_0:
1041+
ipu_image_convert_exit(ipu);
1042+
err_image_convert:
10351043
ipu_vdi_exit(ipu);
10361044
err_vdi:
10371045
ipu_ic_exit(ipu);
@@ -1118,6 +1126,7 @@ static void ipu_submodules_exit(struct ipu_soc *ipu)
11181126
ipu_dc_exit(ipu);
11191127
ipu_di_exit(ipu, 1);
11201128
ipu_di_exit(ipu, 0);
1129+
ipu_image_convert_exit(ipu);
11211130
ipu_vdi_exit(ipu);
11221131
ipu_ic_exit(ipu);
11231132
ipu_csi_exit(ipu, 1);

0 commit comments

Comments
 (0)