← Documents Documentation/userspace-api/media/v4l/app-pri.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / V4L

Application priority

여러 application이 V4L2 device를 공유할 때 file descriptor별 access priority와 선점 규칙을 설명합니다.

Source pathDocumentation/userspace-api/media/v4l/app-pri.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

app-pri.rst:1-30

V4L2 priority ioctl은 background와 사용자 제어 application이 같은 device를 예측 가능하게 공유하도록 합니다. 더 높은 priority를 획득한 application이 있으면 property 변경 ioctl은 `EBUSY`로 실패합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3 .. _app-pri:
4
5 ********************
6 Application Priority
7 ********************
8
9 When multiple applications share a device it may be desirable to assign
10 them different priorities. Contrary to the traditional "rm -rf /" school
11 of thought, a video recording application could for example block other
12 applications from changing video controls or switching the current TV
13 channel. Another objective is to permit low priority applications
14 working in background, which can be preempted by user controlled
15 applications and automatically regain control of the device at a later
16 time.
17
18 Since these features cannot be implemented entirely in user space V4L2
19 defines the :ref:`VIDIOC_G_PRIORITY <VIDIOC_G_PRIORITY>` and
20 :ref:`VIDIOC_S_PRIORITY <VIDIOC_G_PRIORITY>` ioctls to request and
21 query the access priority associate with a file descriptor. Opening a
22 device assigns a medium priority, compatible with earlier versions of
23 V4L2 and drivers not supporting these ioctls. Applications requiring a
24 different priority will usually call :ref:`VIDIOC_S_PRIORITY
25 <VIDIOC_G_PRIORITY>` after verifying the device with the
26 :ref:`VIDIOC_QUERYCAP` ioctl.
27
28 Ioctls changing driver properties, such as
29 :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>`, return an ``EBUSY`` error code
30 after another application obtained higher priority.
31

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

여러 application의 device 공유 우선순위

1-17

여러 application이 하나의 device를 공유할 때 서로 다른 priority를 부여할 필요가 있습니다. 전통적인 `rm -rf /`식 접근과 달리, video recording application이 다른 application의 video control 변경이나 현재 TV channel 전환을 막을 수 있습니다.

또 다른 목적은 background에서 동작하는 low-priority application을 허용하는 것입니다. 이 application은 사용자가 제어하는 application에 의해 preempt될 수 있고, 나중에 자동으로 device control을 되찾을 수 있습니다.

Priority 기반 device 공유
Background application이 low priority로 device 사용사용자 제어 application이 더 높은 priority 획득Low-priority application이 preempt됨Foreground 작업 종료 후 background application이 control 회복

Foreground 작업이 background 작업을 선점한 뒤 control을 돌려줄 수 있습니다.

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _app-pri:

********************
Application Priority
********************

When multiple applications share a device it may be desirable to assign
them different priorities. Contrary to the traditional "rm -rf /" school
of thought, a video recording application could for example block other
applications from changing video controls or switching the current TV
channel. Another objective is to permit low priority applications
working in background, which can be preempted by user controlled
applications and automatically regain control of the device at a later
time.

VIDIOC_G_PRIORITY와 VIDIOC_S_PRIORITY

18-27

이 기능은 userspace만으로 완전히 구현할 수 없으므로 V4L2는 file descriptor와 연결된 access priority를 요청하고 조회하는 `VIDIOC_G_PRIORITY` 및 `VIDIOC_S_PRIORITY` ioctl을 정의합니다.

Device를 열면 medium priority가 지정됩니다. 이는 이전 V4L2 version 및 이 ioctl을 지원하지 않는 driver와 호환됩니다.

다른 priority가 필요한 application은 보통 `VIDIOC_QUERYCAP` ioctl로 device를 확인한 뒤 `VIDIOC_S_PRIORITY`를 호출합니다.

Application priority ioctl
항목설명
VIDIOC_G_PRIORITY현재 access priority 조회
VIDIOC_S_PRIORITY원하는 access priority 요청
VIDIOC_QUERYCAPPriority 설정 전에 device capability 확인
open 기본값Medium priority

File descriptor별 access priority를 관리합니다.

Since these features cannot be implemented entirely in user space V4L2
defines the :ref:`VIDIOC_G_PRIORITY <VIDIOC_G_PRIORITY>` and
:ref:`VIDIOC_S_PRIORITY <VIDIOC_G_PRIORITY>` ioctls to request and
query the access priority associate with a file descriptor. Opening a
device assigns a medium priority, compatible with earlier versions of
V4L2 and drivers not supporting these ioctls. Applications requiring a
different priority will usually call :ref:`VIDIOC_S_PRIORITY
<VIDIOC_G_PRIORITY>` after verifying the device with the
:ref:`VIDIOC_QUERYCAP` ioctl.

더 높은 priority와 EBUSY

28-30

다른 application이 더 높은 priority를 얻은 뒤에는 `VIDIOC_S_INPUT`처럼 driver property를 변경하는 ioctl이 `EBUSY` error code를 반환합니다.

Ioctls changing driver properties, such as
:ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>`, return an ``EBUSY`` error code
after another application obtained higher priority.