- 15 4月, 2021 1 次提交
-
-
由 Hans Verkuil 提交于
When controls are used together with the Request API, then for each request a v4l2_ctrl_handler struct is allocated. This contains the controls that can be set in a request. If a control is *not* set in the request, then the value used in the most recent previous request must be used, or the current value if it is not found in any outstanding requests. The framework tried to find such a previous request and it would set the 'req' pointer in struct v4l2_ctrl_ref to the v4l2_ctrl_ref of the control in such a previous request. So far, so good. However, when that previous request was applied to the hardware, returned to userspace, and then userspace would re-init or free that request, any 'ref' pointer in still-queued requests would suddenly point to freed memory. This was not noticed before since the drivers that use this expected that each request would always have the controls set, so there was never any need to find a control in older requests. This requirement was relaxed, and now this bug surfaced. It was also made worse by changeset 2fae4d6a ("media: v4l2-ctrls: v4l2_ctrl_request_complete() should always set ref->req") which increased the chance of this happening. The use of the 'req' pointer in v4l2_ctrl_ref was very fragile, so drop this entirely. Instead add a valid_p_req bool to indicate that p_req contains a valid value for this control. And if it is false, then just use the current value of the control. Note that VIDIOC_G_EXT_CTRLS will always return -EACCES when attempting to get a control from a request until the request is completed. And in that case, all controls in the request will have the control value set (i.e. valid_p_req is true). This means that the whole 'find the most recent previous request containing a control' idea is pointless, and the code can be simplified considerably. The v4l2_g_ext_ctrls_common() function was refactored a bit to make it more understandable. It also avoids updating volatile controls in a completed request since that was already done when the request was completed. Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Fixes: 2fae4d6a ("media: v4l2-ctrls: v4l2_ctrl_request_complete() should always set ref->req") Fixes: 6fa6f831 ("media: v4l2-ctrls: add core request support") Cc: <stable@vger.kernel.org> # for v5.9 and up Tested-by: NAlexandre Courbot <acourbot@chromium.org> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 06 4月, 2021 5 次提交
-
-
由 Hans Verkuil 提交于
When a request is re-inited it will release all control handler objects that are still in the request. It does that by unbinding and putting all those objects. When the object is unbound the obj->req pointer is set to NULL, and the object's unbind op is called. When the object it put the object's release op is called to free the memory. For a request object that contains a control handler that means that v4l2_ctrl_handler_free() is called in the release op. A control handler used in a request has a pointer to the main control handler that is created by the driver and contains the current state of all controls. If the device is unbound (due to rmmod or a forced unbind), then that main handler is freed, again by calling v4l2_ctrl_handler_free(), and any outstanding request objects that refer to that main handler have to be unbound and put as well. It does that by this test: if (!hdl->req_obj.req && !list_empty(&hdl->requests)) { I.e. the handler has no pointer to a request, so is the main handler, and one or more request objects refer to this main handler. However, this test is wrong since hdl->req_obj.req is actually NULL when re-initing a request (the object unbind will set req to NULL), and the only reason this seemingly worked is that the requests list is typically empty since the request's unbind op will remove the handler from the requests list. But if another thread is at the same time adding a new control to a request, then there is a race condition where one thread is removing a control handler object from the requests list and another thread is adding one. The result is that hdl->requests is no longer empty and the code thinks that a main handler is being freed instead of a control handler that is part of a request. There are two bugs here: first the test for hdl->req_obj.req: this should be hdl->req_obj.ops since only the main control handler will have a NULL pointer there. The second is that adding or deleting request objects from the requests list of the main handler isn't protected by taking the main handler's lock. Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: NJohn Cox <jc@kynesim.co.uk> Fixes: 6fa6f831 ("media: v4l2-ctrls: add core request support") Tested-by: NJohn Cox <jc@kynesim.co.uk> Reported-by: NJohn Cox <jc@kynesim.co.uk> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Stanimir Varbanov 提交于
Introduce Content light level and Mastering display colour volume Colorimetry compound controls with relevant payload structures and validation. Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org> Reviewed-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Stanimir Varbanov 提交于
Add Colorimetry control class for colorimetry controls Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org> Reviewed-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Stanimir Varbanov 提交于
Add decoder v4l2 control to set conceal color. Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org> Reviewed-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Dikshita Agarwal 提交于
Long Term Reference (LTR) frames are the frames that are encoded sometime in the past and stored in the DPB buffer list to be used as reference to encode future frames. This change adds controls to enable this feature. Signed-off-by: NDikshita Agarwal <dikshita@codeaurora.org> Reviewed-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 22 3月, 2021 7 次提交
-
-
由 Stanimir Varbanov 提交于
Add a name of the menu and fill control type. Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Hans Verkuil 提交于
The V4L2_CID_STATELESS_FWHT_PARAMS compound control was missing a proper initialization of the flags field, so after loading the vicodec module for the first time, running v4l2-compliance for the stateless decoder would fail on this control because the initial control value was considered invalid by the vicodec driver. Initializing the flags field to sane values fixes this. Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
Until now, the VP8 V4L2 API was not exported as a public API, and only defined in a private media header (media/vp8-ctrls.h). The reason for this was a concern about the API not complete and ready to support VP8 decoding hardware accelerators. After reviewing the VP8 specification in detail, and now that the API is able to support Cedrus and Hantro G1, we can consider this ready. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
Simply print the type of the control. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
It doesn't seem to add any clarity to have a "header" suffix in controls, struct names and flags. Since this just makes names too long without any benefit, just drop it. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Stanimir Varbanov 提交于
Add a control to enable inserting of AUD NALU into encoded bitstream. Reviewed-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Stanimir Varbanov 提交于
Make display delay and display delay enable MFC controls standard v4l controls. This will allow reuse of the controls for other decoder drivers. Also the new proposed controls are now codec agnostic because they could be used for any codec. Acked-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 27 1月, 2021 1 次提交
-
-
由 Hans Verkuil 提交于
If a menu has more than 64 items, then don't check menu_skip_mask for items 65 and up. Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: syzbot+42d8c7c3d3e594b34346@syzkaller.appspotmail.com Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 14 1月, 2021 3 次提交
-
-
由 Dikshita Agarwal 提交于
This control indicates the priority id to be applied to base layer. [hverkuil: renumbered V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID] Signed-off-by: NDikshita Agarwal <dikshita@codeaurora.org> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Dikshita Agarwal 提交于
Adds bitrate control for all coding layers for h264 same as hevc. Signed-off-by: NDikshita Agarwal <dikshita@codeaurora.org> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Dikshita Agarwal 提交于
- Adds min/max qp controls for B frame for h264. - Adds min/max qp controls for I/P/B frames for hevc similar to h264. - Update valid range of min/max qp for hevc to accommodate 10 bit. Signed-off-by: NDikshita Agarwal <dikshita@codeaurora.org> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 03 12月, 2020 8 次提交
-
-
由 Hans Verkuil 提交于
The FWHT stateless 'uAPI' was staging and marked explicitly in the V4L2 specification that it will change and is unstable. Note that these control IDs were never exported as a public API, they were only defined in kernel-local headers (fwht-ctrls.h). Now, the FWHT stateless controls is ready to be part of the stable uAPI. While not too late: - Rename V4L2_CID_MPEG_VIDEO_FWHT_PARAMS to V4L2_CID_STATELESS_FWHT_PARAMS. - Move the contents of fwht-ctrls.h to v4l2-controls.h. - Move the public parts of drivers/media/test-drivers/vicodec/codec-fwht.h to v4l2-controls.h. - Add V4L2_CTRL_TYPE_FWHT_PARAMS control initialization and validation. - Add p_fwht_params to struct v4l2_ext_control. Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
The H.264 stateless 'uAPI' was staging and marked explicitly in the V4L2 specification that it will change and is unstable. Note that these control IDs were never exported as a public API, they were only defined in kernel-local headers (h264-ctrls.h). Now, the H264 stateless controls is ready to be part of the stable uAPI. While not too late, let's rename them and re-number their control IDs, moving them to the newly created stateless control class, and updating all the drivers accordingly. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Tested-by: NJernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
For now, only print the type of the control. In the future, we might want to be able to print the values of all the stateless codec controls currently set in the control handler, which should be useful for debugging reasons. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
Add a new control class to hold the stateless codecs controls that are ready to be moved out of staging. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Tested-by: NJernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
Check that all the fields that correspond or are related to a H264 specification syntax element have legal values. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Tested-by: NJernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
For historical reasons, stateful codec controls are named as {}_MPEG_{}. While we can't at this point sanely change all control IDs (such as V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER), we can least change the more meaningful macros such as classes macros. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Tested-by: NJernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
Add a debug message for control validation (validate_new) failures. This is useful to debug issues with ioctls such as VIDIOC_TRY_EXT_CTRLS and VIDIOC_S_EXT_CTRLS. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
The VP8_FRAME_HEADER control type is validated, so it needs a corresponding initialization to produce default legal values. For now, only add the minimum required initialization to satisfy current validation. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 17 11月, 2020 1 次提交
-
-
由 Dikshita Agarwal 提交于
remove check for V4L2_CTRL_TYPE_BUTTON from v4l2_ctrl_request_clone and v4l2_ctrl_request_setup(). Signed-off-by: NDikshita Agarwal <dikshita@codeaurora.org> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 14 9月, 2020 1 次提交
-
-
由 Stanimir Varbanov 提交于
Add menu control for VP9 codec levels. A total of 14 levels are defined for Profile 0 (8bit) and Profile 2 (10bit). Each level is a set of constrained bitstreams coded with targeted resolutions, frame rates, and bitrates. The definitions have been taken from webm project [1]. [1] https://www.webmproject.org/vp9/levels/Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org> Reviewed-by: NNicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 01 9月, 2020 5 次提交
-
-
由 Stanimir Varbanov 提交于
Adds encoders standard v4l2 control for frame-skip. The control is a copy of a custom encoder control so that other v4l2 encoder drivers can use it. Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org> Reviewed-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Maheshwar Ajja 提交于
When V4L2_CID_MPEG_VIDEO_BITRATE_MODE value is V4L2_MPEG_VIDEO_BITRATE_MODE_CQ, encoder will produce constant quality output indicated by V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY control value. Encoder will choose appropriate quantization parameter and bitrate to produce requested frame quality level. Signed-off-by: NMaheshwar Ajja <majja@codeaurora.org> Reviewed-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
The H.264 specification requires in section 7.4.3 "Slice header semantics", that the following values shall be the same in all slice headers: pic_parameter_set_id frame_num field_pic_flag bottom_field_flag idr_pic_id pic_order_cnt_lsb delta_pic_order_cnt_bottom delta_pic_order_cnt[ 0 ] delta_pic_order_cnt[ 1 ] sp_for_switch_flag slice_group_change_cycle These bitstream fields are part of the slice header, and therefore passed redundantly on each slice. The purpose of the redundancy is to make the codec fault-tolerant in network scenarios. This is of course not needed to be reflected in the V4L2 controls, given the bitstream has already been parsed by applications. Therefore, move the redundant fields to the per-frame decode parameters control (DECODE_PARAMS). Field 'pic_parameter_set_id' is simply removed in this case, because the PPS control must currently contain the active PPS. Syntax elements dec_ref_pic_marking() and those related to pic order count, remain invariant as well, and therefore, the fields dec_ref_pic_marking_bit_size and pic_order_cnt_bit_size are also common to all slices. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Reviewed-by: NNicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: NJonas Karlman <jonas@kwiboo.se> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
DPB entry PicNum maximum value is 2*MaxFrameNum for interlaced content (field_pic_flag=1). As specified, MaxFrameNum is 2^(log2_max_frame_num_minus4 + 4) and log2_max_frame_num_minus4 is in the range of 0 to 12, which means pic_num should be a 32-bit field. The v4l2_h264_dpb_entry struct needs to be padded to avoid a hole, which might be also useful to allow future uAPI extensions. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Tested-by: NJonas Karlman <jonas@kwiboo.se> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Ezequiel Garcia 提交于
The prediction weight parameters are only required under certain conditions, which depend on slice header parameters. As specified in section 7.3.3 Slice header syntax, the prediction weight table is present if: ((weighted_pred_flag && (slice_type == P || slice_type == SP)) || \ (weighted_bipred_idc == 1 && slice_type == B)) Given its size, it makes sense to move this table to its control, so applications can avoid passing it if the slice doesn't specify it. Before this change struct v4l2_ctrl_h264_slice_params was 960 bytes. With this change, it's 188 bytes and struct v4l2_ctrl_h264_pred_weight is 772 bytes. Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com> Tested-by: NJonas Karlman <jonas@kwiboo.se> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 24 8月, 2020 1 次提交
-
-
由 Gustavo A. R. Silva 提交于
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-throughSigned-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
-
- 12 6月, 2020 1 次提交
-
-
由 Jonas Karlman 提交于
Wrong loop filter flag is unset when tiles enabled flag is not set, this cause HEVC decoding issues with Rockchip Video Decoder. Fix this by unsetting the loop filter across tiles enabled flag instead of the pps loop filter across slices enabled flag when tiles are disabled. Fixes: 256fa392 ("media: v4l: Add definitions for HEVC stateless decoding") Signed-off-by: NJonas Karlman <jonas@kwiboo.se> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 18 5月, 2020 3 次提交
-
-
由 Jacopo Mondi 提交于
Add an helper function to v4l2-ctrls to register controls associated with a device property. Signed-off-by: NJacopo Mondi <jacopo@jmondi.org> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Jacopo Mondi 提交于
Before adding a new include directive, sort the existing ones in alphabetical order. Signed-off-by: NJacopo Mondi <jacopo@jmondi.org> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Jacopo Mondi 提交于
Add support for the newly defined V4L2_CID_CAMERA_ORIENTATION and V4L2_CID_CAMERA_SENSOR_ROTATION read-only controls used to report the camera device mounting position and orientation respectively. Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: NJacopo Mondi <jacopo@jmondi.org> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
- 21 4月, 2020 3 次提交
-
-
由 Hans Verkuil 提交于
Rather than creating new compound control helpers for each new type, create one generic function and just create defines on top. Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Tested-by: NPaul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Hans Verkuil 提交于
If the v4l2_ctrl_g_ctrl*() or __v4l2_ctrl_s_ctrl*() functions are called for the wrong control type then they call WARN_ON since that is a driver error. But they still continue, potentially overwriting data. Change this to return an error (s_ctrl) or 0 (g_ctrl), just to be safe. Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-
由 Maheshwar Ajja 提交于
Add H264 profile "Contrained High" and H264 levels "5.2", "6.0", "6.1" and "6.2". Signed-off-by: NMaheshwar Ajja <majja@codeaurora.org> Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
-