* is it possible to use single IOCTL to setup media pipeline? @ 2018-11-22 2:51 Zhang, Ning A 2018-11-22 7:06 ` Tomasz Figa 0 siblings, 1 reply; 5+ messages in thread From: Zhang, Ning A @ 2018-11-22 2:51 UTC (permalink / raw) To: linux-media@vger.kernel.org; +Cc: Zhang, Ning A Hello everyone when we need to setup media pipeline, eg, for camera capture, media-ctl needs to be called multiple time to setup media link and subdev formats, or similar code in a single application. this will use multiple IOCTLs on "/dev/mediaX" and "/dev/v4l2-subdevY". to setup media pipeline in userspace requires to fully understanding the topology of the media stack. but the fact is only media driver developer could know how to setup media pipeline. each time driver updates, this would break userspace application if application engineers don't know this change. In this case, if a IOCTL is designed to setup media pipeline, no need to update applications, after driver is updated. this will not only benefit for design a single IOCTL, this also helps to hide the detail of media pipeline, by load a binary blob which holds information about how to setup pipeline, or hide it in bootloader/ACPI tables/device tree, etc. another benefit is save time for setup media pipeline, if there is a PKI like "time for open camera". as my test, this will saves hundreds of milliseconds. is this acceptable? BR. Ning. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: is it possible to use single IOCTL to setup media pipeline? 2018-11-22 2:51 is it possible to use single IOCTL to setup media pipeline? Zhang, Ning A @ 2018-11-22 7:06 ` Tomasz Figa 2018-11-22 8:59 ` Zhang, Ning A 2018-11-22 13:46 ` Sakari Ailus 0 siblings, 2 replies; 5+ messages in thread From: Tomasz Figa @ 2018-11-22 7:06 UTC (permalink / raw) To: ning.a.zhang; +Cc: Linux Media Mailing List Hi Ning, On Thu, Nov 22, 2018 at 11:52 AM Zhang, Ning A <ning.a.zhang@intel.com> wrote: > > Hello everyone > > when we need to setup media pipeline, eg, for camera capture, media-ctl > needs to be called multiple time to setup media link and subdev > formats, or similar code in a single application. this will use > multiple IOCTLs on "/dev/mediaX" and "/dev/v4l2-subdevY". > > to setup media pipeline in userspace requires to fully understanding > the topology of the media stack. but the fact is only media driver > developer could know how to setup media pipeline. each time driver > updates, this would break userspace application if application > engineers don't know this change. That's obviously a bug in the driver. Kernel interfaces must not change in a way that are not compatible with the userspace. > In this case, if a IOCTL is designed > to setup media pipeline, no need to update applications, after driver > is updated. > > this will not only benefit for design a single IOCTL, this also helps > to hide the detail of media pipeline, by load a binary blob which holds > information about how to setup pipeline, or hide it in bootloader/ACPI > tables/device tree, etc. Media pipeline configuration is specific to the use case. If you hardcode it in the driver or bootloader, the user will not be able to use any other use case than the hardcoded blob, which is unacceptable for Linux drivers. Instead, it sounds like your userspace should be designed in a way that the media topology configuration is loaded from a configuration file that you could either get from your kernel driver developer or just maintain yourself based on any changes the media developers do. Of course that's unrelated to the backwards compatibility issue, which should not happen normally. The configuration file would be helpful for handling future extensions and new hardware platforms. > > another benefit is save time for setup media pipeline, if there is a > PKI like "time for open camera". as my test, this will saves hundreds > of milliseconds. For this problem, the proper solution would be to create an ioctl that can aggregate setting multiple parts of the topology in one go. For example, V4L2 has VIDIOC_S_CTRL for setting a control, but there is also VIDIOC_S_EXT_CTRLS, which lets you set multiple controls in one call. Something like VIDIOC_S_EXT_CTRLS for configuring the media topology would solve the performance problem. Best regards, Tomasz ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: is it possible to use single IOCTL to setup media pipeline? 2018-11-22 7:06 ` Tomasz Figa @ 2018-11-22 8:59 ` Zhang, Ning A 2018-11-22 13:46 ` Sakari Ailus 1 sibling, 0 replies; 5+ messages in thread From: Zhang, Ning A @ 2018-11-22 8:59 UTC (permalink / raw) To: tfiga@chromium.org; +Cc: Zhang, Ning A, linux-media@vger.kernel.org Tomasz, Thank you for your answers. learned a lot. BR. Ning. 在 2018-11-22四的 16:06 +0900,Tomasz Figa写道: > Hi Ning, > > On Thu, Nov 22, 2018 at 11:52 AM Zhang, Ning A <ning.a.zhang@intel.co > m> wrote: > > > > Hello everyone > > > > when we need to setup media pipeline, eg, for camera capture, > > media-ctl > > needs to be called multiple time to setup media link and subdev > > formats, or similar code in a single application. this will use > > multiple IOCTLs on "/dev/mediaX" and "/dev/v4l2-subdevY". > > > > to setup media pipeline in userspace requires to fully > > understanding > > the topology of the media stack. but the fact is only media driver > > developer could know how to setup media pipeline. each time driver > > updates, this would break userspace application if application > > engineers don't know this change. > > That's obviously a bug in the driver. Kernel interfaces must not > change in a way that are not compatible with the userspace. I met this issue :( > > > In this case, if a IOCTL is designed > > to setup media pipeline, no need to update applications, after > > driver > > is updated. > > > > this will not only benefit for design a single IOCTL, this also > > helps > > to hide the detail of media pipeline, by load a binary blob which > > holds > > information about how to setup pipeline, or hide it in > > bootloader/ACPI > > tables/device tree, etc. > > Media pipeline configuration is specific to the use case. If you > hardcode it in the driver or bootloader, the user will not be able to > use any other use case than the hardcoded blob, which is unacceptable > for Linux drivers. > > Instead, it sounds like your userspace should be designed in a way > that the media topology configuration is loaded from a configuration > file that you could either get from your kernel driver developer or > just maintain yourself based on any changes the media developers do. > Of course that's unrelated to the backwards compatibility issue, > which > should not happen normally. The configuration file would be helpful > for handling future extensions and new hardware platforms. yes, if there are multiple user cases, then this is not optional. > > > > > another benefit is save time for setup media pipeline, if there is > > a > > PKI like "time for open camera". as my test, this will saves > > hundreds > > of milliseconds. > > For this problem, the proper solution would be to create an ioctl > that > can aggregate setting multiple parts of the topology in one go. For > example, V4L2 has VIDIOC_S_CTRL for setting a control, but there is > also VIDIOC_S_EXT_CTRLS, which lets you set multiple controls in one > call. Something like VIDIOC_S_EXT_CTRLS for configuring the media > topology would solve the performance problem. this may be alternative choice. > > > Best regards, > Tomasz ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: is it possible to use single IOCTL to setup media pipeline? 2018-11-22 7:06 ` Tomasz Figa 2018-11-22 8:59 ` Zhang, Ning A @ 2018-11-22 13:46 ` Sakari Ailus 2018-11-22 13:56 ` Tomasz Figa 1 sibling, 1 reply; 5+ messages in thread From: Sakari Ailus @ 2018-11-22 13:46 UTC (permalink / raw) To: Tomasz Figa; +Cc: ning.a.zhang, Linux Media Mailing List Hi Tomasz, On Thu, Nov 22, 2018 at 04:06:36PM +0900, Tomasz Figa wrote: > Hi Ning, > > On Thu, Nov 22, 2018 at 11:52 AM Zhang, Ning A <ning.a.zhang@intel.com> wrote: > > > > Hello everyone > > > > when we need to setup media pipeline, eg, for camera capture, media-ctl > > needs to be called multiple time to setup media link and subdev > > formats, or similar code in a single application. this will use > > multiple IOCTLs on "/dev/mediaX" and "/dev/v4l2-subdevY". > > > > to setup media pipeline in userspace requires to fully understanding > > the topology of the media stack. but the fact is only media driver > > developer could know how to setup media pipeline. each time driver > > updates, this would break userspace application if application > > engineers don't know this change. > > That's obviously a bug in the driver. Kernel interfaces must not > change in a way that are not compatible with the userspace. Alternatively, this could result from fixing a bug in a driver. Or adding features that were not previously supported. In this case there are often no perfect solutions to address all the issues at hand. > > > In this case, if a IOCTL is designed > > to setup media pipeline, no need to update applications, after driver > > is updated. > > > > this will not only benefit for design a single IOCTL, this also helps > > to hide the detail of media pipeline, by load a binary blob which holds > > information about how to setup pipeline, or hide it in bootloader/ACPI > > tables/device tree, etc. > > Media pipeline configuration is specific to the use case. If you > hardcode it in the driver or bootloader, the user will not be able to > use any other use case than the hardcoded blob, which is unacceptable > for Linux drivers. > > Instead, it sounds like your userspace should be designed in a way > that the media topology configuration is loaded from a configuration > file that you could either get from your kernel driver developer or > just maintain yourself based on any changes the media developers do. > Of course that's unrelated to the backwards compatibility issue, which > should not happen normally. The configuration file would be helpful > for handling future extensions and new hardware platforms. > > > > > another benefit is save time for setup media pipeline, if there is a > > PKI like "time for open camera". as my test, this will saves hundreds > > of milliseconds. > > For this problem, the proper solution would be to create an ioctl that > can aggregate setting multiple parts of the topology in one go. For > example, V4L2 has VIDIOC_S_CTRL for setting a control, but there is > also VIDIOC_S_EXT_CTRLS, which lets you set multiple controls in one > call. Something like VIDIOC_S_EXT_CTRLS for configuring the media > topology would solve the performance problem. There have been ideas of moving all IOCTL handling to the media device, in a way that would allow issuing them in the same fashion than controls. This was discussed in last year's media summit actually. I think this could be done once the request API is otherwise working for e.g. camera devices. I don't expect this to materialise in near (or even medium) term though. -- Regards, Sakari Ailus e-mail: sakari.ailus@iki.fi ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: is it possible to use single IOCTL to setup media pipeline? 2018-11-22 13:46 ` Sakari Ailus @ 2018-11-22 13:56 ` Tomasz Figa 0 siblings, 0 replies; 5+ messages in thread From: Tomasz Figa @ 2018-11-22 13:56 UTC (permalink / raw) To: Sakari Ailus; +Cc: ning.a.zhang, Linux Media Mailing List On Thu, Nov 22, 2018 at 10:46 PM Sakari Ailus <sakari.ailus@iki.fi> wrote: > > Hi Tomasz, > > On Thu, Nov 22, 2018 at 04:06:36PM +0900, Tomasz Figa wrote: > > Hi Ning, > > > > On Thu, Nov 22, 2018 at 11:52 AM Zhang, Ning A <ning.a.zhang@intel.com> wrote: > > > > > > Hello everyone > > > > > > when we need to setup media pipeline, eg, for camera capture, media-ctl > > > needs to be called multiple time to setup media link and subdev > > > formats, or similar code in a single application. this will use > > > multiple IOCTLs on "/dev/mediaX" and "/dev/v4l2-subdevY". > > > > > > to setup media pipeline in userspace requires to fully understanding > > > the topology of the media stack. but the fact is only media driver > > > developer could know how to setup media pipeline. each time driver > > > updates, this would break userspace application if application > > > engineers don't know this change. > > > > That's obviously a bug in the driver. Kernel interfaces must not > > change in a way that are not compatible with the userspace. > > Alternatively, this could result from fixing a bug in a driver. Or adding > features that were not previously supported. > > In this case there are often no perfect solutions to address all the issues > at hand. An upstream kernel driver must maintain compatibility even in such cases, which isn't the most convenient thing for driver developers, but that's something we have to live with if we want to have users. > > > > > > In this case, if a IOCTL is designed > > > to setup media pipeline, no need to update applications, after driver > > > is updated. > > > > > > this will not only benefit for design a single IOCTL, this also helps > > > to hide the detail of media pipeline, by load a binary blob which holds > > > information about how to setup pipeline, or hide it in bootloader/ACPI > > > tables/device tree, etc. > > > > Media pipeline configuration is specific to the use case. If you > > hardcode it in the driver or bootloader, the user will not be able to > > use any other use case than the hardcoded blob, which is unacceptable > > for Linux drivers. > > > > Instead, it sounds like your userspace should be designed in a way > > that the media topology configuration is loaded from a configuration > > file that you could either get from your kernel driver developer or > > just maintain yourself based on any changes the media developers do. > > Of course that's unrelated to the backwards compatibility issue, which > > should not happen normally. The configuration file would be helpful > > for handling future extensions and new hardware platforms. > > > > > > > > another benefit is save time for setup media pipeline, if there is a > > > PKI like "time for open camera". as my test, this will saves hundreds > > > of milliseconds. > > > > For this problem, the proper solution would be to create an ioctl that > > can aggregate setting multiple parts of the topology in one go. For > > example, V4L2 has VIDIOC_S_CTRL for setting a control, but there is > > also VIDIOC_S_EXT_CTRLS, which lets you set multiple controls in one > > call. Something like VIDIOC_S_EXT_CTRLS for configuring the media > > topology would solve the performance problem. > > There have been ideas of moving all IOCTL handling to the media device, in > a way that would allow issuing them in the same fashion than controls. This > was discussed in last year's media summit actually. I think this could be > done once the request API is otherwise working for e.g. camera devices. I > don't expect this to materialise in near (or even medium) term though. I'm aware of those talks and we actually took this into consideration when developing the Request API. Hopefully we can speed up the work on this to make it happen medium term at latest, if not short term, as it's going to be quite important for the complex camera subsystems, especially in the days of all the counter measures against the speculative execution vulnerabilities. Best regards, Tomasz ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-11-23 0:36 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-11-22 2:51 is it possible to use single IOCTL to setup media pipeline? Zhang, Ning A 2018-11-22 7:06 ` Tomasz Figa 2018-11-22 8:59 ` Zhang, Ning A 2018-11-22 13:46 ` Sakari Ailus 2018-11-22 13:56 ` Tomasz Figa
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox