Hi Emil, On Mon, 2021-05-17 at 19:37 +0100, Emil Velikov wrote: > Hi everyone, > > This RFC aims to kick off a discussion about adding ftrace events in > V4L2 and mem2mem in particular. > > The goal is to aid both userspace and kernel developers alike by > allowing them to trace their individual application/library and drivers, > respectively. > We'll need some developer-oriented docs, perhaps in Documentation/userspace-api/media/ or similar, with some examples and some guidelines. Also, could you add some scripts somewhere to show us how these are used/enabled? > > # Data provided > > In order to correlate the components through their lifetime we need a > few unique identifiers: > > - minor: the device minor, aka /dev/video > Useful, when multiple devices are present. > > - fh: file handle > Allows us to map the buffer, ioctl and mem2mem jobs. > > - fh: as a job instance... sort of > We also use it as to distinguish between the different jobs, as long > as we track the cancel/finish events. > > > Additionally, for buffers we need: > - type: VIDEO_OUTPUT_MPLANE, VIDEO_CAPTURE_MPLANE, etc > - index: buffer index > Each buffer type has its own pool. > > > # Event list and examples > > Generic: > > v4l2_ioctl_s_fmt: minor = 0, fh = 5068c670, type = VIDEO_OUTPUT_MPLANE, > width=1280, height=720, ... > > v4l2_qbuf: minor = 0, fh = 5068c670, index = 0, type = > VIDEO_CAPTURE_MPLANE, bytesused = 0, ... > v4l2_dqbuf: minor = 0, fh = 5068c670, index = 0, type = > VIDEO_CAPTURE_MPLANE, bytesused = 0, ... > > > Mem2mem specific: > > v4l2_m2m_schedule: minor = 0, fh = 5068c670 > v4l2_m2m_schedule_failed: minor = 0, fh = 5068c670, reason = NO_SRC > v4l2_m2m_queue_job: minor = 0, fh = 5068c670, src = 0, dst = 0 > Currently src and dst only show the buffer index. Buffer type can be > deduced based on the type of job - encode or decode. > > v4l2_m2m_run_job: minor = 0, fh = 5068c670 > v4l2_m2m_cancel_job: minor = 0, fh = 5068c670 > v4l2_m2m_finish_job: minor = 0, fh = 5068c670 > > v4l2_m2m_stream_on: minor = 0, fh = 5068c670, type = f9e16c2e > v4l2_m2m_stream_off: minor = 0, fh = 5068c670, type = f9e16c2e > > v4l2_m2m_buf_done: minor = 0, fh = 5068c670, index = 0, type = > VIDEO_CAPTURE_MPLANE, state = DONE > Do we need something to distinguish the Job ID? Thanks, Ezequiel