IPUv3 prep for i.MX5/6 v4l2 staging drivers, v5
Subsystems (4)
v5 cover IPUv3 prep for i.MX5/6 v4l2 staging drivers, v5
This now contains only the queued image conversion support, along with a split-out patch that adds macro ipu_rot_mode_is_irt().
Steve Longerbeam (2):
gpu: ipu-v3: Add ipu_rot_mode_is_irt()
gpu: ipu-v3: Add queued image conversion support
drivers/gpu/ipu-v3/Makefile | 3 +- drivers/gpu/ipu-v3/ipu-common.c | 9 + drivers/gpu/ipu-v3/ipu-ic.c | 2 +- drivers/gpu/ipu-v3/ipu-image-convert.c | 1721 ++++++++++++++++++++++++++++++++ drivers/gpu/ipu-v3/ipu-prv.h | 5 + include/video/imx-image-convert.h | 207 ++++ include/video/imx-ipu-v3.h | 22 +- 7 files changed, 1960 insertions(+), 9 deletions(-) create mode 100644 drivers/gpu/ipu-v3/ipu-image-convert.c create mode 100644 include/video/imx-image-convert.h
Signature · 1 line
2.7.4
PATCH v5 1/2 gpu: ipu-v3: Add ipu_rot_mode_is_irt()
Add a macro that returns boolean true if the given ipu_rotate_mode requires the use of the Image Rotator.
--- drivers/gpu/ipu-v3/ipu-ic.c | 2 +- include/video/imx-ipu-v3.h | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-)
drivers/gpu/ipu-v3/ipu-ic.c +1 -1
@@ -619,7 +619,7 @@ int ipu_ic_task_idma_init(struct ipu_ic *ic, struct ipuv3_channel *channel,ipu_ic_write (ic, ic_idmac_2,IC_IDMAC_2 );ipu_ic_write (ic, ic_idmac_3,IC_IDMAC_3 ); -if (rot >=IPU_ROTATE_90_RIGHT ) +if (ipu_rot_mode_is_irt (rot)) ic->rotation = true; unlock:
include/video/imx-ipu-v3.h +15 -7
@@ -63,17 +63,25 @@ enum ipu_csi_dest {/* * Enumeration of IPU rotation modes */ +#define IPU_ROT_BIT_VFLIP (1 << 0) +#define IPU_ROT_BIT_HFLIP (1 << 1) +#define IPU_ROT_BIT_90 (1 << 2) +enum ipu_rotate_mode {IPU_ROTATE_NONE =0 , -IPU_ROTATE_VERT_FLIP , -IPU_ROTATE_HORIZ_FLIP , -IPU_ROTATE_180 , -IPU_ROTATE_90_RIGHT , -IPU_ROTATE_90_RIGHT_VFLIP , -IPU_ROTATE_90_RIGHT_HFLIP , -IPU_ROTATE_90_LEFT , +IPU_ROTATE_VERT_FLIP =IPU_ROT_BIT_VFLIP , +IPU_ROTATE_HORIZ_FLIP =IPU_ROT_BIT_HFLIP , +IPU_ROTATE_180 = (IPU_ROT_BIT_VFLIP |IPU_ROT_BIT_HFLIP ), +IPU_ROTATE_90_RIGHT =IPU_ROT_BIT_90 , +IPU_ROTATE_90_RIGHT_VFLIP = (IPU_ROT_BIT_90 |IPU_ROT_BIT_VFLIP ), +IPU_ROTATE_90_RIGHT_HFLIP = (IPU_ROT_BIT_90 |IPU_ROT_BIT_HFLIP ), +IPU_ROTATE_90_LEFT = (IPU_ROT_BIT_90 | +IPU_ROT_BIT_VFLIP |IPU_ROT_BIT_HFLIP ), }; +/* 90-degree rotations require the IRT unit */ +#define ipu_rot_mode_is_irt (m) (((m) & IPU_ROT_BIT_90) != 0) +enum ipu_color_space {IPUV3_COLORSPACE_RGB ,IPUV3_COLORSPACE_YUV ,
Signature · 1 line
2.7.4
PATCH v5 2/2 gpu: ipu-v3: Add queued image conversion support
In reply to Steve LongerbeamThis 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().
---
v5:
- moved all the ipu_image_convert support to ipu-image-convert.c. Prototypes moved to include/video/imx-image-convert.h with comment headers.
- removed the IC_TASK_ENCODE channels from image_convert_dma_chan[] list. The encode task cannnot be used by the image converter, since this task has no memory source IDMAC channels (buffers come directly from CSI).
- renamed some structs and a few of the exported APIs: struct image_converter is renamed ipu_image_convert_chan, ipu_image_convert_run() is renamed ipu_image_convert_queue().
- the ipu_ic handle passed to ipu_image_convert_prepare() is replaced by the IPU handle and IC task that are requested for carrying out the conversion. The image converter acquires the ipu_ic handle internally, in get_ipu_resources() along with the other resources required.
- removed .name field in the supported pixel format list, and ipu_image_convert_enum_format() no longer takes a char* desc arg.
- y_depth in 'struct ipu_image_pixfmt' replaced with boolean planar (Y pixel depth is always 8 bits).
- removed dmabuf reallocation in alloc_dma_buf().
- added lockdep_assert_held() to functions that require the irqlock.
- added IC task number to dev_dbg() output.
- exported 'struct ipu_image_convert_run'. ipu_image_convert_queue() now takes a run pointer. Caller must dynamically allocate and fill the run with a conversion context handle and the input/output buffer dma addresses, and free the run object when it is returned in the completion callback.
- ipu_image_convert_adjust() is now a void.
v4:
- do away with struct ipu_ic_tile_off, and move tile offsets into struct ipu_ic_tile. This paves the way for possibly allowing for each tile to have different dimensions in the future.
v3: no changes
v2: no changes
--- drivers/gpu/ipu-v3/Makefile | 3 +- drivers/gpu/ipu-v3/ipu-common.c | 9 + drivers/gpu/ipu-v3/ipu-image-convert.c | 1721 ++++++++++++++++++++++++++++++++ drivers/gpu/ipu-v3/ipu-prv.h | 5 + include/video/imx-image-convert.h | 207 ++++ 5 files changed, 1944 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/ipu-v3/ipu-image-convert.c create mode 100644 include/video/imx-image-convert.h
drivers/gpu/ipu-v3/Makefile +2 -1
@@ -1,4 +1,5 @@ obj-$(CONFIG_IMX_IPUV3_CORE) += imx-ipu-v3.o imx-ipu-v3-objs := ipu-common.o ipu-cpmem.o ipu-csi.o ipu-dc.o ipu-di.o \ - ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-smfc.o + ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-image-convert.o \ + ipu-smfc.o
drivers/gpu/ipu-v3/ipu-common.c +9 -0
@@ -839,6 +839,12 @@ static int ipu_submodules_init(struct ipu_soc *ipu, goto err_ic; } + ret =ipu_image_convert_init (ipu, dev); +if (ret) { + unit ="image_convert" ; + goto err_image_convert; + } + ret =ipu_di_init (ipu, dev,0 , ipu_base + devtype->disp0_ofs,IPU_CONF_DI0_EN , ipu_clk);if (ret) {
@@ -893,6 +899,8 @@ err_dc: err_di_1:ipu_di_exit (ipu,0 ); err_di_0: +ipu_image_convert_exit (ipu); +err_image_convert:ipu_ic_exit (ipu); err_ic:ipu_csi_exit (ipu,1 );
@@ -977,6 +985,7 @@ static void ipu_submodules_exit(struct ipu_soc *ipu)ipu_dc_exit (ipu);ipu_di_exit (ipu,1 );ipu_di_exit (ipu,0 ); +ipu_image_convert_exit (ipu);ipu_ic_exit (ipu);ipu_csi_exit (ipu,1 );ipu_csi_exit (ipu,0 );
drivers/gpu/ipu-v3/ipu-image-convert.c new file +1717 -0
1,717 lines not on this page · raw message
drivers/gpu/ipu-v3/ipu-prv.h +5 -0
@@ -138,6 +138,7 @@ struct ipu_dc_priv;struct ipu_dmfc_priv ;struct ipu_di ;struct ipu_ic_priv ; +struct ipu_image_convert_priv ;struct ipu_smfc_priv ;struct ipu_devtype ;
@@ -170,6 +171,7 @@ struct ipu_soc {struct ipu_di *di_priv[2 ];struct ipu_csi *csi_priv[2 ];struct ipu_ic_priv *ic_priv; +struct ipu_image_convert_priv *image_convert_priv;struct ipu_smfc_priv *smfc_priv; };
@@ -200,6 +202,9 @@ int ipu_ic_init(struct ipu_soc *ipu, struct device *dev, unsigned long base, unsigned long tpmem_base);void ipu_ic_exit (struct ipu_soc *ipu); +int ipu_image_convert_init (struct ipu_soc *ipu,struct device *dev); +void ipu_image_convert_exit (struct ipu_soc *ipu); +int ipu_di_init (struct ipu_soc *ipu,struct device *dev,int id,unsigned long base,u32 module,struct clk *ipu_clk);void ipu_di_exit (struct ipu_soc *ipu,int id);
include/video/imx-image-convert.h new file +207 -0
207 lines not on this page · raw message
Signature · 1 line
2.7.4