Re: [PATCH v8 14/14] media: platform: Add jpeg dec/enc feature
On Mon, 2020-05-11 at 11:04 +0200, Hans Verkuil wrote: > On 03/04/2020 11:40, Xia Jiang wrote: > > Add mtk jpeg encode v4l2 driver based on jpeg decode, because that jpeg > > decode and encode have great similarities with function operation. > > > > Signed-off-by: Xia Jiang > > --- > > v8:jpeg encoder and decoder use separate callbacks instead of repeating > >the if/else in every callback. > >improve vidioc_try_fmt() implementation that can be shared by jpeg > >encoder and decoder. > >fix the bug of jpeg encoder s_selection implementation. > >cancel the state of the jpeg encoder. > >improve jpeg encoder and decoder set default params flow. > >put the clock names and other datas in a match_data struct. > >fix the bug of geting correctly quality value. > >do the all the bits' settings of one register in one function. > >move the code of mtk_jpeg_enc_reg.h to mtk_jpeg_enc_hw.h and delete > >mtk_jpeg_enc_reg.h. > > > > v7: reverse spin lock and unlock operation in device run function for > > multi-instance. > > > > v6: add space to arounding '+'. > > alignment 'struct mtk_jpeg_fmt *fmt' match open parenthesis. > > change 'mtk_jpeg_enc_set_encFormat' to 'mtk_jpeg_enc_set_enc_format'. > > make 'mtk_jpeg_ctrls_setup' to static prototype. > > delete unused variables 'jpeg'/'align_h'/'align_w'/'flags'. > > initialize 'yuv_format'/'enc_quality' variables. > > > > v5: support crop for encoder and compose for decoder in s_selection and > > g_selection function. > > use clamp() to replace mtk_jpeg_bound_align_image() and round_up() > > to replace mtk_jpeg_align(). > > delete jpeg_enc_param/mtk_jpeg_enc_param structure and > > mtk_jpeg_set_param(), program the registers directly based on > > the original V4L2 values. > > move macro definition about hw to mtk_jpeg_enc_reg.h. > > delete unnecessary V4L2 logs in driver. > > cancel spin lock and unlock operation in deviec run function. > > change jpeg enc register offset hex numberals from upercase to > > lowercase. > > > > v4: split mtk_jpeg_try_fmt_mplane() to two functions, one for encoder, > > > > one for decoder. > > > > split mtk_jpeg_set_default_params() to two functions, one for > > > > encoder, one for decoder. > > > > add cropping support for encoder in g/s_selection ioctls. > > > > change exif mode support by using V4L2_JPEG_ACTIVE_MARKER_APP1. > > > > change MTK_JPEG_MAX_WIDTH/MTK_JPEG_MAX_HEIGH from 8192 to 65535 by > > > > specification. > > move width shifting operation behind aligning operation in > > > > mtk_jpeg_try_enc_fmt_mplane() for bug fix. > > > > fix user abuseing data_offset issue for DMABUF in > > > > mtk_jpeg_set_enc_src(). > > > > fix kbuild warings: change MTK_JPEG_MIN_HEIGHT/MTK_JPEG_MAX_HEIGHT > > > > and MTK_JPEG_MIN_WIDTH/MTK_JPEG_MAX_WIDTH from > > > > 'int' type to 'unsigned int' type. > > > > fix msleadingly indented of 'else'. > > > > > > v3: delete Change-Id. > > > > only test once handler->error after the last v4l2_ctrl_new_std(). > > > > seperate changes of v4l2-ctrls.c and v4l2-controls.h to new patch. > > > > v2: fix compliance test fail, check created buffer size in driver. > > --- > > drivers/media/platform/mtk-jpeg/Makefile |5 +- > > .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 1038 + > > .../media/platform/mtk-jpeg/mtk_jpeg_core.h | 51 +- > > .../media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h |7 +- > > .../media/platform/mtk-jpeg/mtk_jpeg_enc_hw.c | 193 +++ > > .../media/platform/mtk-jpeg/mtk_jpeg_enc_hw.h | 123 ++ > > 6 files changed, 1188 insertions(+), 229 deletions(-) > > create mode 100644
Re: [PATCH v8 14/14] media: platform: Add jpeg dec/enc feature
On Mon, May 11, 2020 at 11:04:19AM +0200, Hans Verkuil wrote: > On 03/04/2020 11:40, Xia Jiang wrote: > > Add mtk jpeg encode v4l2 driver based on jpeg decode, because that jpeg > > decode and encode have great similarities with function operation. > > > > Signed-off-by: Xia Jiang > > --- > > v8:jpeg encoder and decoder use separate callbacks instead of repeating > >the if/else in every callback. > >improve vidioc_try_fmt() implementation that can be shared by jpeg > >encoder and decoder. > >fix the bug of jpeg encoder s_selection implementation. > >cancel the state of the jpeg encoder. > >improve jpeg encoder and decoder set default params flow. > >put the clock names and other datas in a match_data struct. > >fix the bug of geting correctly quality value. > >do the all the bits' settings of one register in one function. > >move the code of mtk_jpeg_enc_reg.h to mtk_jpeg_enc_hw.h and delete > >mtk_jpeg_enc_reg.h. > > > > v7: reverse spin lock and unlock operation in device run function for > > multi-instance. > > > > v6: add space to arounding '+'. > > alignment 'struct mtk_jpeg_fmt *fmt' match open parenthesis. > > change 'mtk_jpeg_enc_set_encFormat' to 'mtk_jpeg_enc_set_enc_format'. > > make 'mtk_jpeg_ctrls_setup' to static prototype. > > delete unused variables 'jpeg'/'align_h'/'align_w'/'flags'. > > initialize 'yuv_format'/'enc_quality' variables. > > > > v5: support crop for encoder and compose for decoder in s_selection and > > g_selection function. > > use clamp() to replace mtk_jpeg_bound_align_image() and round_up() > > to replace mtk_jpeg_align(). > > delete jpeg_enc_param/mtk_jpeg_enc_param structure and > > mtk_jpeg_set_param(), program the registers directly based on > > the original V4L2 values. > > move macro definition about hw to mtk_jpeg_enc_reg.h. > > delete unnecessary V4L2 logs in driver. > > cancel spin lock and unlock operation in deviec run function. > > change jpeg enc register offset hex numberals from upercase to > > lowercase. > > > > v4: split mtk_jpeg_try_fmt_mplane() to two functions, one for encoder, > > > > one for decoder. > > > > split mtk_jpeg_set_default_params() to two functions, one for > > > > encoder, one for decoder. > > > > add cropping support for encoder in g/s_selection ioctls. > > > > change exif mode support by using V4L2_JPEG_ACTIVE_MARKER_APP1. > > > > change MTK_JPEG_MAX_WIDTH/MTK_JPEG_MAX_HEIGH from 8192 to 65535 by > > > > specification. > > move width shifting operation behind aligning operation in > > > > mtk_jpeg_try_enc_fmt_mplane() for bug fix. > > > > fix user abuseing data_offset issue for DMABUF in > > > > mtk_jpeg_set_enc_src(). > > > > fix kbuild warings: change MTK_JPEG_MIN_HEIGHT/MTK_JPEG_MAX_HEIGHT > > > > and MTK_JPEG_MIN_WIDTH/MTK_JPEG_MAX_WIDTH from > > > > 'int' type to 'unsigned int' type. > > > > fix msleadingly indented of 'else'. > > > > > > v3: delete Change-Id. > > > > only test once handler->error after the last v4l2_ctrl_new_std(). > > > > seperate changes of v4l2-ctrls.c and v4l2-controls.h to new patch. > > > > v2: fix compliance test fail, check created buffer size in driver. > > --- > > drivers/media/platform/mtk-jpeg/Makefile |5 +- > > .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 1038 + > > .../media/platform/mtk-jpeg/mtk_jpeg_core.h | 51 +- > > .../media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h |7 +- > > .../media/platform/mtk-jpeg/mtk_jpeg_enc_hw.c | 193 +++ > > .../media/platform/mtk-jpeg/mtk_jpeg_enc_hw.h | 123 ++ > > 6 files changed, 1188 insertions(+), 229 deletions(-) > > create mode 100644
Re: [PATCH v8 14/14] media: platform: Add jpeg dec/enc feature
On 03/04/2020 11:40, Xia Jiang wrote: > Add mtk jpeg encode v4l2 driver based on jpeg decode, because that jpeg > decode and encode have great similarities with function operation. > > Signed-off-by: Xia Jiang > --- > v8:jpeg encoder and decoder use separate callbacks instead of repeating >the if/else in every callback. >improve vidioc_try_fmt() implementation that can be shared by jpeg >encoder and decoder. >fix the bug of jpeg encoder s_selection implementation. >cancel the state of the jpeg encoder. >improve jpeg encoder and decoder set default params flow. >put the clock names and other datas in a match_data struct. >fix the bug of geting correctly quality value. >do the all the bits' settings of one register in one function. >move the code of mtk_jpeg_enc_reg.h to mtk_jpeg_enc_hw.h and delete >mtk_jpeg_enc_reg.h. > > v7: reverse spin lock and unlock operation in device run function for > multi-instance. > > v6: add space to arounding '+'. > alignment 'struct mtk_jpeg_fmt *fmt' match open parenthesis. > change 'mtk_jpeg_enc_set_encFormat' to 'mtk_jpeg_enc_set_enc_format'. > make 'mtk_jpeg_ctrls_setup' to static prototype. > delete unused variables 'jpeg'/'align_h'/'align_w'/'flags'. > initialize 'yuv_format'/'enc_quality' variables. > > v5: support crop for encoder and compose for decoder in s_selection and > g_selection function. > use clamp() to replace mtk_jpeg_bound_align_image() and round_up() > to replace mtk_jpeg_align(). > delete jpeg_enc_param/mtk_jpeg_enc_param structure and > mtk_jpeg_set_param(), program the registers directly based on > the original V4L2 values. > move macro definition about hw to mtk_jpeg_enc_reg.h. > delete unnecessary V4L2 logs in driver. > cancel spin lock and unlock operation in deviec run function. > change jpeg enc register offset hex numberals from upercase to lowercase. > > v4: split mtk_jpeg_try_fmt_mplane() to two functions, one for encoder, > > one for decoder. > split mtk_jpeg_set_default_params() to two functions, one for > > encoder, one for decoder. > > add cropping support for encoder in g/s_selection ioctls. > > change exif mode support by using V4L2_JPEG_ACTIVE_MARKER_APP1. > > change MTK_JPEG_MAX_WIDTH/MTK_JPEG_MAX_HEIGH from 8192 to 65535 by > > specification. > move width shifting operation behind aligning operation in > > mtk_jpeg_try_enc_fmt_mplane() for bug fix. > > fix user abuseing data_offset issue for DMABUF in > > mtk_jpeg_set_enc_src(). > > fix kbuild warings: change MTK_JPEG_MIN_HEIGHT/MTK_JPEG_MAX_HEIGHT > > and MTK_JPEG_MIN_WIDTH/MTK_JPEG_MAX_WIDTH from > > 'int' type to 'unsigned int' type. > > fix msleadingly indented of 'else'. > > > v3: delete Change-Id. > > only test once handler->error after the last v4l2_ctrl_new_std(). > > seperate changes of v4l2-ctrls.c and v4l2-controls.h to new patch. > > v2: fix compliance test fail, check created buffer size in driver. > --- > drivers/media/platform/mtk-jpeg/Makefile |5 +- > .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 1038 + > .../media/platform/mtk-jpeg/mtk_jpeg_core.h | 51 +- > .../media/platform/mtk-jpeg/mtk_jpeg_dec_hw.h |7 +- > .../media/platform/mtk-jpeg/mtk_jpeg_enc_hw.c | 193 +++ > .../media/platform/mtk-jpeg/mtk_jpeg_enc_hw.h | 123 ++ > 6 files changed, 1188 insertions(+), 229 deletions(-) > create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_enc_hw.c > create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_enc_hw.h > > diff --git a/drivers/media/platform/mtk-jpeg/Makefile > b/drivers/media/platform/mtk-jpeg/Makefile > index 48516dcf96e6..76c33aad0f3f