Closed kevinshieh0225 closed 2 years ago
const struct v4l2_frmsize_discrete *sz = v4l2_find_nearest_size(
vcam_sizes, n_avail, width, height, f->fmt.pix.width,
f->fmt.pix.height);
, and you would pass the scaling test on v4l2-compliance.
TRY_FMT
should not change the driver state, but it could reset the size.
reference vivid_try_fmt_vid_cap
The vivid
is a Linux kernel test device driver and pass all v4l2-compliance test.fb.c/vcamfb_update
can remalloc space for the sizeimage, and set var.xres
var.yres
actually seen on the window.
The var.xres_virtual
and var.yres_virtual
are real space size in memory.
reference The Frame Buffer Device
6.control.c/control_iocontrol_modify_input_setting
use the old API need to change.Thanks for @WayneLin1992 's reply!
vivid_try_fmt_vid_cap
only fill in negotiate information to user, but didn't actually reset the size setting from the device. vivid_s_fmt_vid_cap
is the function which change the device setting. I still think it is better to change the behavior according to the API description.vcamfb_update
and vcam_in_queue_destroy/setup
together? Which in former function rebuild vcamfb
but only change in_queue
attribute, and the latter one only rebuild in_queue
without vcamfb
.in/out_queue
setting, is it necessary to destroy and init a new in/out_queue
, or we only need to change the attribute only? And this is the reason why in your vcamfb_update
implementation, you only change the attribute on in/out_queue instead of re-init them?Thanks for @kevinshieh0225
TRY_FMT
it will fill format negotiated for device, and S_FMT
is actually reset the device size from format.vcam_in_queue_destroy/setup
is old API for vcamfb
, so it need to combine with vcamfb_update
.in_queue
.
There is a few problems in
VIDIOC_G/TRY/S_FMT
implementation. Some issue result in test fail on v4l2-compliance, others comes from that the implement is incompliant with document description, and nevertheless some questions from my own.allow_scaling=1
allow_scaling=1
will lead to test failure onVIDIOC_G/TRY/S_FMT
(710). The issue comes from the inconsistency, which the return format first acquire fromG_FMT
should match the later returning format fromTRY_FMT
.allow_scaling=1
,TRY_FMT
would force to change the ouputbuffer and vcamfb size to {1280, 720}, I am curious that is it intended?TRY_FMT
should not change the driver state. The job should transfer toS_FMT
to accomplish.allow_scaling=1
,TRY_FMT
will always return fmt with size={1280, 720}. Than test [710] will always fail if default size was not {1280, 720}.allow_cropping=1
dev->crop_output_format
is first assign inTRY_FMT
. However in practice, application would first callG_FMT
to query current format, than further callS_FMT
to modify the desire format. The problem lead to test fail in (441) and also (710). The assignment should be happen beforeG_FMT
were called. (In my opinion, it might be reasonable to assign whilecreate_vcam_device
).vcamfb_update
TRY/S_FMT
, while the device can handle different input and output buffer format insubmit_copy_buffer
fb.c/vcamfb_update
andcontrol.c/control_iocontrol_modify_input_setting
, in my opinion, the two function has similar purpose and might be a chance to combine together?