df71c6e4 | 12-Aug-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Lock on ioctl encoder/decoder stop cmd
the ioctl encoder/decoder cmd is under queue lock, and buf_done is in the irq, it can't be locked with the mutex, they are not synchronized. w
media: imx-jpeg: Lock on ioctl encoder/decoder stop cmd
the ioctl encoder/decoder cmd is under queue lock, and buf_done is in the irq, it can't be locked with the mutex, they are not synchronized. when v4l2_update_last_buf_state is called to handle the encoder/decoder stop cmd, the last src buffer may be done at the same time.
so it's possible that last_src_buf is set, but the output rdy_queue is empty, then driver won't mark it stopped, as v4l2_m2m_is_last_draining_src_buf() will always return false and v4l2_m2m_dst_buf_is_last() return false too.
In this case, the drain will be blocked.
add the hw lock around the ioctl encoder/decoder cmd, to synchronize with the buf_done.
Fixes: 4911c5acf935 ("media: imx-jpeg: Implement drain using v4l2-mem2mem helpers") Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
ccc9f1db | 27-Sep-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Support contiguous and non contiguous format
mxc-jpeg supports non contiguous format nv12m, and in order to compatible with the devices that only support contiguous format nv12, jpe
media: imx-jpeg: Support contiguous and non contiguous format
mxc-jpeg supports non contiguous format nv12m, and in order to compatible with the devices that only support contiguous format nv12, jpeg can support nv12 and nv12m in the same time.
Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil: document is_rgb variable]
show more ...
|
8b450a82 | 27-Sep-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Implement g_selection and s_selection
The codec can support any image size WxH, with arbitrary W (image width) and H (image height) dimensions.
But it requires buffer alignment, so
media: imx-jpeg: Implement g_selection and s_selection
The codec can support any image size WxH, with arbitrary W (image width) and H (image height) dimensions.
But it requires buffer alignment, so driver can report the aligned resolution through the g_fmt, and report the actual resolution through the g_selection.
For encoder, it even support to encode a smaller jpeg than the original picture through s_selection api.
For the decoder, we do not support cropping a portion smaller than the original picture, due to hardware limitations (wrapper side).
Fixes: 9e7aa76cdb02 ("media: imx-jpeg: Align upwards buffer size") Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
c3720e65 | 04-Aug-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Disable useless interrupt to avoid kernel panic
There is a hardware bug that the interrupt STMBUF_HALF may be triggered after or when disable interrupt. It may led to unexpected ker
media: imx-jpeg: Disable useless interrupt to avoid kernel panic
There is a hardware bug that the interrupt STMBUF_HALF may be triggered after or when disable interrupt. It may led to unexpected kernel panic. And interrupt STMBUF_HALF and STMBUF_RTND have no other effect. So disable them and the unused interrupts.
meanwhile clear the interrupt status when disable interrupt.
Signed-off-by: Ming Qian <ming.qian@nxp.com> Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
c76c2e92 | 26-Jul-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Don't clear stop state in handling dynamic resolution change
In dynamic resolution change, streamoff and streamon on the capture queue may be called, the V4L2_DEC_CMD_STOP cmd may b
media: imx-jpeg: Don't clear stop state in handling dynamic resolution change
In dynamic resolution change, streamoff and streamon on the capture queue may be called, the V4L2_DEC_CMD_STOP cmd may be called before driver parsed the jpeg header. don't clear the stop state in streamoff of handling the dynamic resolution change, otherwise the drain may not complete.
Fixes: 4911c5acf9351 ("media: imx-jpeg: Implement drain using v4l2-mem2mem helpers") Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
cfed9632 | 18-Jul-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Add a timeout mechanism for each frame
Add a timeout mechanism for each frame. If the frame can't be decoded or encoded, driver can cancel it to avoid hang.
Fixes: 2db16c6ed72ce ("
media: imx-jpeg: Add a timeout mechanism for each frame
Add a timeout mechanism for each frame. If the frame can't be decoded or encoded, driver can cancel it to avoid hang.
Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder") Signed-off-by: Ming Qian <ming.qian@nxp.com> Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
4911c5ac | 30-May-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Implement drain using v4l2-mem2mem helpers
v4l2 m2m has supplied some helper function to handle drain, so the driver can use the helper function directly.
Fixes: d8ebe298d008c ("me
media: imx-jpeg: Implement drain using v4l2-mem2mem helpers
v4l2 m2m has supplied some helper function to handle drain, so the driver can use the helper function directly.
Fixes: d8ebe298d008c ("media: imx-jpeg: Set V4L2_BUF_FLAG_LAST at eos") Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
9e7aa76c | 30-May-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Align upwards buffer size
The hardware can support any image size WxH, with arbitrary W (image width) and H (image height) dimensions.
Align upwards buffer size for both encoder an
media: imx-jpeg: Align upwards buffer size
The hardware can support any image size WxH, with arbitrary W (image width) and H (image height) dimensions.
Align upwards buffer size for both encoder and decoder. and leave the picture resolution unchanged.
For decoder, the risk of memory out of bounds can be avoided. For both encoder and decoder, the driver will lift the limitation of resolution alignment.
For example, the decoder can support jpeg whose resolution is 227x149 the encoder can support nv12 1080P, won't change it to 1920x1072.
Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder") Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
6285cdea | 30-May-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Leave a blank space before the configuration data
There is a hardware bug that it will load the first 128 bytes of configuration data twice, it will led to some configure error. so
media: imx-jpeg: Leave a blank space before the configuration data
There is a hardware bug that it will load the first 128 bytes of configuration data twice, it will led to some configure error. so shift the configuration data 128 bytes, and make the first 128 bytes all zero, then hardware will load the 128 zero twice, and ignore them as garbage. then the configuration data can be loaded correctly
Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder") Signed-off-by: Ming Qian <ming.qian@nxp.com> Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com> Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
b4e1fb86 | 23-Mar-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Support dynamic resolution change
To support dynamic resolution change, driver should meet the following conditions: 1. the previous pictures are all decoded before source change ev
media: imx-jpeg: Support dynamic resolution change
To support dynamic resolution change, driver should meet the following conditions: 1. the previous pictures are all decoded before source change event. 2. prevent decoding new resolution pictures with incorrect capture buffer, until user handle source change event and setup capture. 3. report correct fmt and resolution during source change.
Signed-off-by: Ming Qian <ming.qian@nxp.com> Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
831f8742 | 23-Mar-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Handle source change in a function
Refine code to support dynamic resolution change
Signed-off-by: Ming Qian <ming.qian@nxp.com> Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com
media: imx-jpeg: Handle source change in a function
Refine code to support dynamic resolution change
Signed-off-by: Ming Qian <ming.qian@nxp.com> Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
ef2feed1 | 23-Mar-2022 |
Ming Qian <ming.qian@nxp.com> |
media: imx-jpeg: Propagate the output frame size to the capture side
The GStreamer v4l2videodec only ever calls S_FMT on the output side and then expects G_FMT on the capture side to return a valid
media: imx-jpeg: Propagate the output frame size to the capture side
The GStreamer v4l2videodec only ever calls S_FMT on the output side and then expects G_FMT on the capture side to return a valid format.
Signed-off-by: Ming Qian <ming.qian@nxp.com> Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|