요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. _event:
***************
Event Interface
***************
The V4L2 event interface provides a means for a user to get immediately
notified on certain conditions taking place on a device. This might
include start of frame or loss of signal events, for example. Changes in
the value or state of a V4L2 control can also be reported through
events.
To receive events, the events the user is interested in first must be
subscribed using the
:ref:`VIDIOC_SUBSCRIBE_EVENT` ioctl. Once
an event is subscribed, the events of subscribed types are dequeueable
using the :ref:`VIDIOC_DQEVENT` ioctl. Events may be
unsubscribed using VIDIOC_UNSUBSCRIBE_EVENT ioctl. The special event
type V4L2_EVENT_ALL may be used to unsubscribe all the events the
driver supports.
The event subscriptions and event queues are specific to file handles.
Subscribing an event on one file handle does not affect other file
handles.
The information on dequeueable events is obtained by using select or
poll system calls on video devices. The V4L2 events use POLLPRI events
on poll system call and exceptions on select system call.
Starting with kernel 3.1 certain guarantees can be given with regards to
events:
1. Each subscribed event has its own internal dedicated event queue.
This means that flooding of one event type will not interfere with
other event types.
2. If the internal event queue for a particular subscribed event becomes
full, then the oldest event in that queue will be dropped.
3. Where applicable, certain event types can ensure that the payload of
the oldest event that is about to be dropped will be merged with the
payload of the next oldest event. Thus ensuring that no information
is lost, but only an intermediate step leading up to that
information. See the documentation for the event you want to
subscribe to whether this is applicable for that event or not.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Event 구독과 전달
1-30V4L2 event 인터페이스는 장치에서 특정 조건이 발생했을 때 사용자가 즉시 통지받는 방법을 제공합니다. frame 시작, signal 손실뿐 아니라 V4L2 control 값이나 상태의 변경도 event로 보고할 수 있습니다.
관심 event를 받으려면 먼저 `VIDIOC_SUBSCRIBE_EVENT`로 구독해야 합니다. 구독한 type의 event는 `VIDIOC_DQEVENT`로 dequeue할 수 있고 `VIDIOC_UNSUBSCRIBE_EVENT`로 구독을 해제합니다. 특별한 `V4L2_EVENT_ALL` type을 사용하면 driver가 지원하는 모든 event를 한 번에 해제할 수 있습니다.
event subscription과 event queue는 file handle별로 분리됩니다. 한 file handle에서 event를 구독해도 다른 handle에는 영향을 주지 않습니다.
dequeue 가능한 event가 있는지는 video device에 `select` 또는 `poll` system call을 사용해 확인합니다. V4L2 event는 `poll`에서는 `POLLPRI`, `select`에서는 exception 조건을 사용합니다.
구독부터 readiness 확인과 dequeue까지의 기본 절차입니다.
subscription과 queue의 소유 단위입니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. _event:
***************
Event Interface
***************
The V4L2 event interface provides a means for a user to get immediately
notified on certain conditions taking place on a device. This might
include start of frame or loss of signal events, for example. Changes in
the value or state of a V4L2 control can also be reported through
events.
To receive events, the events the user is interested in first must be
subscribed using the
:ref:`VIDIOC_SUBSCRIBE_EVENT` ioctl. Once
an event is subscribed, the events of subscribed types are dequeueable
using the :ref:`VIDIOC_DQEVENT` ioctl. Events may be
unsubscribed using VIDIOC_UNSUBSCRIBE_EVENT ioctl. The special event
type V4L2_EVENT_ALL may be used to unsubscribe all the events the
driver supports.
The event subscriptions and event queues are specific to file handles.
Subscribing an event on one file handle does not affect other file
handles.
The information on dequeueable events is obtained by using select or
poll system calls on video devices. The V4L2 events use POLLPRI events
on poll system call and exceptions on select system call.
Kernel 3.1 이후 event queue 보장
31-47kernel 3.1부터 구독 event의 queue 동작에 세 가지 보장이 적용됩니다. 첫째, 구독한 event마다 내부 전용 queue가 있으므로 한 event type이 폭주해도 다른 type을 방해하지 않습니다.
둘째, 특정 구독 event의 내부 queue가 가득 차면 그 queue의 가장 오래된 event를 버립니다.
셋째, 적용 가능한 event type은 버리려는 가장 오래된 event의 payload를 그다음으로 오래된 event payload에 병합할 수 있습니다. 이 경우 최종 정보는 잃지 않고 그 정보에 이르는 중간 단계만 생략됩니다. 이 병합이 가능한지는 구독하려는 각 event 문서를 확인해야 합니다.
event type별 전용 queue와 가득 찼을 때의 처리입니다.
Starting with kernel 3.1 certain guarantees can be given with regards to
events:
1. Each subscribed event has its own internal dedicated event queue.
This means that flooding of one event type will not interfere with
other event types.
2. If the internal event queue for a particular subscribed event becomes
full, then the oldest event in that queue will be dropped.
3. Where applicable, certain event types can ensure that the payload of
the oldest event that is about to be dropped will be merged with the
payload of the next oldest event. Thus ensuring that no information
is lost, but only an intermediate step leading up to that
information. See the documentation for the event you want to
subscribe to whether this is applicable for that event or not.
요약·해설
dev-event.rst:1-47Event는 file handle별 독립 queue를 사용합니다. event type별 overflow가 서로 격리되며, 지원되는 경우 payload 병합으로 최종 정보를 보존합니다.