Hi all,
This patch set implements region of interest(ROI) support for
video encoder to be configured as a MB based delta_qp for
the whole frame. Custom controls V4L2_CID_MPEG_VIDEO_ROI_MB_DELTA_QP
and V4L2_CID_MPEG_VIDEO_ROI_MB_SIZE are implemented to achieve this.
Corresponding support is added in iris encoder to implement this
feature.
This submission and design is based on the feedback received
from community for the RFC[1] series posted earlier.
Initial testing is done by adding support to v4l2-ctl[2] to test this
control setting and its functionality.
[1]https://lore.kernel.org/linux-media/20260113-iris_enc_roi-v1-0-6c86eba38587@oss.qualcomm.com
[2]https://lore.kernel.org/linux-media/20260616-enc_roi_enable-v1-1-252792d27894@oss.qualcomm.com
Results:
v4l2-ctl -d /dev/video1 --list-ctrls
...
enc_mb_roi_delta_qp 0x00990b92 (s8) : min=-31 max=30 step=1 default=0 dims=[139264] flags=has-payload
roi_mb_size 0x00990b93 (u8) : min=16 max=32 step=1 default=16 value=16 flags=has-payload
v4l2-compliance -d /dev/video1
...
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test CREATE_BUFS maximum buffers: OK
test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)
test blocking wait: OK
Total for iris_driver device /dev/video1: 48, Succeeded: 48, Failed: 0, Warnings: 0
./v4l2-ctl --verbose -d /dev/video1 --set-fmt-video-out=width=176,height=144,pixelformat=NV12 --set-fmt-video=pixelformat=H264 --set-ctrl=enc_mb_roi_delta_qp=-20,-2,-22,9,-16,-2,14,-9,-19,3,-26,19,-23,30,1,0,-6,-7,7,2,-2,15,-15,-24,-24,-26,-26,5,-1,-1,9,-11,15,-25,-11,26,-11,7,-26,-27,-8,-18,7,-4,-12,-23,-11,22,-7,7,-14,24,6,-8,-7,2,7,-26,2,-25,-1,-3,-4,-6,-26,-11,7,16,-30,-22,-15,30,-14,-29,-11,-8,8,6,19,15,-17,21,-27,30,-17,-28,-10,-20,1,22,29,-19,-2,28,10,12,-10,7,-4 --stream-mmap --stream-out-mmap --stream-from=/media/foreman_qcif_nv12.yuv --stream-to=roi_try.h264 --stream-count=10
Validated on SM8550 MTP.
Thanks,
Deepa
Signed-off-by: Deepa Guthyappa Madivalara
<deepa.madivalara@oss.qualcomm.com>
Signed-off-by: Deepa Guthyappa Madivalara <deepa.madivalara@oss.qualcomm.com>
---
Changes in v2:
- Fix issues detected by Media CI robot and kernel test robot.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202606171554.03yt9utn-lkp@intel.com/
- Rebase onto media-committers next.
- Update to handle p_s8 in std_validate_elem correctly.
- Link to v1: https://lore.kernel.org/r/20260616-enc_roi_enable-v1-0-fefcc4e76f33@oss.qualcomm.com
---
Deepa Guthyappa Madivalara (3):
media: uapi: Introduce new control for video encoder ROI
media: v4l2-core: Add support for video encoder ROI control
media: iris: Add ROI support framework for iris video encoder
.../userspace-api/media/v4l/ext-ctrls-codec.rst | 14 +++
.../media/v4l/videodev2.h.rst.exceptions | 1 +
.../userspace-api/media/v4l/vidioc-g-ext-ctrls.rst | 4 +
.../userspace-api/media/v4l/vidioc-queryctrl.rst | 6 ++
drivers/media/platform/qcom/iris/iris_buffer.c | 101 ++++++++++++++++++++
drivers/media/platform/qcom/iris/iris_buffer.h | 22 +++++
drivers/media/platform/qcom/iris/iris_ctrls.c | 104 ++++++++++++++++++++-
drivers/media/platform/qcom/iris/iris_ctrls.h | 3 +
drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 +
drivers/media/platform/qcom/iris/iris_hfi_gen2.c | 16 +++-
.../platform/qcom/iris/iris_hfi_gen2_command.c | 62 ++++++++++++
.../platform/qcom/iris/iris_hfi_gen2_defines.h | 3 +
.../platform/qcom/iris/iris_hfi_gen2_packet.c | 6 +-
.../platform/qcom/iris/iris_hfi_gen2_packet.h | 3 +
.../platform/qcom/iris/iris_hfi_gen2_response.c | 29 ++++++
.../platform/qcom/iris/iris_platform_common.h | 5 +
drivers/media/platform/qcom/iris/iris_venc.c | 4 +
drivers/media/platform/qcom/iris/iris_venc.h | 2 +
drivers/media/platform/qcom/iris/iris_vidc.c | 2 +
drivers/media/v4l2-core/v4l2-ctrls-api.c | 1 +
drivers/media/v4l2-core/v4l2-ctrls-core.c | 40 +++++++-
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 10 ++
include/media/v4l2-ctrls.h | 2 +
include/uapi/linux/v4l2-controls.h | 2 +
include/uapi/linux/videodev2.h | 3 +
25 files changed, 439 insertions(+), 7 deletions(-)
---
base-commit: 6c3a86e563b5c79e4429d8aa4cde39b2485bf969
change-id: 20260616-enc_roi_enable-4d385c4783ae
Best regards,
--
Deepa Guthyappa Madivalara <deepa.madivalara@oss.qualcomm.com>