Message ID | 20250411074347.809-1-ming.qian@oss.nxp.com |
---|---|
Headers | show |
Series | media: imx-jpeg: Fix some motion-jpeg decoding | expand |
On Fri, Apr 11, 2025 at 03:43:40PM +0800, ming.qian@oss.nxp.com wrote: > From: Ming Qian <ming.qian@oss.nxp.com> > > Move function mxc_jpeg_free_slot_data() above mxc_jpeg_alloc_slot_data() > allowing to call that function during allocation failures. > No functional changes are made. > > Signed-off-by: Ming Qian <ming.qian@oss.nxp.com> > Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> > --- > .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 46 +++++++++++-------- > 1 file changed, 26 insertions(+), 20 deletions(-) > > diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c > index 0e6ee997284b..b2f7e9ad1885 100644 > --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c > +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c > @@ -752,6 +752,32 @@ static int mxc_get_free_slot(struct mxc_jpeg_slot_data *slot_data) > return -1; > } > > +static void mxc_jpeg_free_slot_data(struct mxc_jpeg_dev *jpeg) > +{ > + /* free descriptor for decoding/encoding phase */ > + dma_free_coherent(jpeg->dev, sizeof(struct mxc_jpeg_desc), > + jpeg->slot_data.desc, > + jpeg->slot_data.desc_handle); > + jpeg->slot_data.desc = NULL; > + jpeg->slot_data.desc_handle = 0; You add above two lines, it is not simple move function. Move above two line change to next patch. Frank > + > + /* free descriptor for encoder configuration phase / decoder DHT */ > + dma_free_coherent(jpeg->dev, sizeof(struct mxc_jpeg_desc), > + jpeg->slot_data.cfg_desc, > + jpeg->slot_data.cfg_desc_handle); > + jpeg->slot_data.cfg_desc_handle = 0; > + jpeg->slot_data.cfg_desc = NULL; The same here. > + > + /* free configuration stream */ > + dma_free_coherent(jpeg->dev, MXC_JPEG_MAX_CFG_STREAM, > + jpeg->slot_data.cfg_stream_vaddr, > + jpeg->slot_data.cfg_stream_handle); > + jpeg->slot_data.cfg_stream_vaddr = NULL; > + jpeg->slot_data.cfg_stream_handle = 0; The same here. > + > + jpeg->slot_data.used = false; > +} > + > static bool mxc_jpeg_alloc_slot_data(struct mxc_jpeg_dev *jpeg) > { > struct mxc_jpeg_desc *desc; > @@ -798,26 +824,6 @@ static bool mxc_jpeg_alloc_slot_data(struct mxc_jpeg_dev *jpeg) > return false; > } > > -static void mxc_jpeg_free_slot_data(struct mxc_jpeg_dev *jpeg) > -{ > - /* free descriptor for decoding/encoding phase */ > - dma_free_coherent(jpeg->dev, sizeof(struct mxc_jpeg_desc), > - jpeg->slot_data.desc, > - jpeg->slot_data.desc_handle); > - > - /* free descriptor for encoder configuration phase / decoder DHT */ > - dma_free_coherent(jpeg->dev, sizeof(struct mxc_jpeg_desc), > - jpeg->slot_data.cfg_desc, > - jpeg->slot_data.cfg_desc_handle); > - > - /* free configuration stream */ > - dma_free_coherent(jpeg->dev, MXC_JPEG_MAX_CFG_STREAM, > - jpeg->slot_data.cfg_stream_vaddr, > - jpeg->slot_data.cfg_stream_handle); > - > - jpeg->slot_data.used = false; > -} > - > static void mxc_jpeg_check_and_set_last_buffer(struct mxc_jpeg_ctx *ctx, > struct vb2_v4l2_buffer *src_buf, > struct vb2_v4l2_buffer *dst_buf) > -- > 2.43.0-rc1 >
From: Ming Qian <ming.qian@oss.nxp.com> To support decoding motion-jpeg without DHT, driver will try to decode a pattern jpeg before actual jpeg frame by use of linked descriptors (This is called "repeat mode"), then the DHT in the pattern jpeg can be used for decoding the motion-jpeg. But there is some hardware limitation in the repeat mode, that may cause corruption or decoding timeout. Try to make workaround for these limitation in this patchset. Ming Qian (4): media: imx-jpeg: Move mxc_jpeg_free_slot_data() ahead media: imx-jpeg: Cleanup after an allocation error media: imx-jpeg: Change the pattern size to 128x64 media: imx-jpeg: Check decoding is ongoing for motion-jpeg .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 1 + .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 120 +++++++++++++----- .../media/platform/nxp/imx-jpeg/mxc-jpeg.h | 5 + 3 files changed, 97 insertions(+), 29 deletions(-)