Documentation/fb/pxafb.rst GitHub 원문 ↗

Linux 6.18.37 · Frame Buffer

Driver for PXA25x LCD controller

PXA25x LCD와 PXA27x overlay 설정·정렬·ioctl 절차의 한국어 전문 번역입니다.

Source pathDocumentation/fb/pxafb.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

pxafb.rst:1-173

PXA framebuffer 문서는 PXA25x LCD timing과 panel polarity, PXA27x 이후 overlay의 RGB/YUV format, 동적 memory 할당, alignment와 ioctl 운용 절차를 설명합니다.

PXA overlay 핵심
display timing 설정overlay format과 위치 encode32-bit boundary 검증`FBIOPUT_VSCREENINFO``FBIOGET_FSCREENINFO``mmap`과 component 관리

base plane 안에서 정렬된 overlay를 할당하고 mmap합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ================================
2 Driver for PXA25x LCD controller
3 ================================
4
5 The driver supports the following options, either via
6 options=<OPTIONS> when modular or video=pxafb:<OPTIONS> when built in.
7
8 For example::
9
10 modprobe pxafb options=vmem:2M,mode:640x480-8,passive
11
12 or on the kernel command line::
13
14 video=pxafb:vmem:2M,mode:640x480-8,passive
15
16 vmem: VIDEO_MEM_SIZE
17
18 Amount of video memory to allocate (can be suffixed with K or M
19 for kilobytes or megabytes)
20
21 mode:XRESxYRES[-BPP]
22
23 XRES == LCCR1_PPL + 1
24
25 YRES == LLCR2_LPP + 1
26
27 The resolution of the display in pixels
28
29 BPP == The bit depth. Valid values are 1, 2, 4, 8 and 16.
30
31 pixclock:PIXCLOCK
32
33 Pixel clock in picoseconds
34
35 left:LEFT == LCCR1_BLW + 1
36
37 right:RIGHT == LCCR1_ELW + 1
38
39 hsynclen:HSYNC == LCCR1_HSW + 1
40
41 upper:UPPER == LCCR2_BFW
42
43 lower:LOWER == LCCR2_EFR
44
45 vsynclen:VSYNC == LCCR2_VSW + 1
46
47 Display margins and sync times
48
49 color | mono => LCCR0_CMS
50
51 umm...
52
53 active | passive => LCCR0_PAS
54
55 Active (TFT) or Passive (STN) display
56
57 single | dual => LCCR0_SDS
58
59 Single or dual panel passive display
60
61 4pix | 8pix => LCCR0_DPD
62
63 4 or 8 pixel monochrome single panel data
64
65 hsync:HSYNC, vsync:VSYNC
66
67 Horizontal and vertical sync. 0 => active low, 1 => active
68 high.
69
70 dpc:DPC
71
72 Double pixel clock. 1=>true, 0=>false
73
74 outputen:POLARITY
75
76 Output Enable Polarity. 0 => active low, 1 => active high
77
78 pixclockpol:POLARITY
79
80 pixel clock polarity
81 0 => falling edge, 1 => rising edge
82
83
84 Overlay Support for PXA27x and later LCD controllers
85 ====================================================
86
87 PXA27x and later processors support overlay1 and overlay2 on-top of the
88 base framebuffer (although under-neath the base is also possible). They
89 support palette and no-palette RGB formats, as well as YUV formats (only
90 available on overlay2). These overlays have dedicated DMA channels and
91 behave in a similar way as a framebuffer.
92
93 However, there are some differences between these overlay framebuffers
94 and normal framebuffers, as listed below:
95
96 1. overlay can start at a 32-bit word aligned position within the base
97 framebuffer, which means they have a start (x, y). This information
98 is encoded into var->nonstd (no, var->xoffset and var->yoffset are
99 not for such purpose).
100
101 2. overlay framebuffer is allocated dynamically according to specified
102 'struct fb_var_screeninfo', the amount is decided by::
103
104 var->xres_virtual * var->yres_virtual * bpp
105
106 bpp = 16 -- for RGB565 or RGBT555
107
108 bpp = 24 -- for YUV444 packed
109
110 bpp = 24 -- for YUV444 planar
111
112 bpp = 16 -- for YUV422 planar (1 pixel = 1 Y + 1/2 Cb + 1/2 Cr)
113
114 bpp = 12 -- for YUV420 planar (1 pixel = 1 Y + 1/4 Cb + 1/4 Cr)
115
116 NOTE:
117
118 a. overlay does not support panning in x-direction, thus
119 var->xres_virtual will always be equal to var->xres
120
121 b. line length of overlay(s) must be on a 32-bit word boundary,
122 for YUV planar modes, it is a requirement for the component
123 with minimum bits per pixel, e.g. for YUV420, Cr component
124 for one pixel is actually 2-bits, it means the line length
125 should be a multiple of 16-pixels
126
127 c. starting horizontal position (XPOS) should start on a 32-bit
128 word boundary, otherwise the fb_check_var() will just fail.
129
130 d. the rectangle of the overlay should be within the base plane,
131 otherwise fail
132
133 Applications should follow the sequence below to operate an overlay
134 framebuffer:
135
136 a. open("/dev/fb[1-2]", ...)
137 b. ioctl(fd, FBIOGET_VSCREENINFO, ...)
138 c. modify 'var' with desired parameters:
139
140 1) var->xres and var->yres
141 2) larger var->yres_virtual if more memory is required,
142 usually for double-buffering
143 3) var->nonstd for starting (x, y) and color format
144 4) var->{red, green, blue, transp} if RGB mode is to be used
145
146 d. ioctl(fd, FBIOPUT_VSCREENINFO, ...)
147 e. ioctl(fd, FBIOGET_FSCREENINFO, ...)
148 f. mmap
149 g. ...
150
151 3. for YUV planar formats, these are actually not supported within the
152 framebuffer framework, application has to take care of the offsets
153 and lengths of each component within the framebuffer.
154
155 4. var->nonstd is used to pass starting (x, y) position and color format,
156 the detailed bit fields are shown below::
157
158 31 23 20 10 0
159 +-----------------+---+----------+----------+
160 | ... unused ... |FOR| XPOS | YPOS |
161 +-----------------+---+----------+----------+
162
163 FOR - color format, as defined by OVERLAY_FORMAT_* in pxafb.h
164
165 - 0 - RGB
166 - 1 - YUV444 PACKED
167 - 2 - YUV444 PLANAR
168 - 3 - YUV422 PLANAR
169 - 4 - YUR420 PLANAR
170
171 XPOS - starting horizontal position
172
173 YPOS - starting vertical position
174

3. 한국어 전문 번역

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

PXA25x 메모리, 해상도와 sync timing

1-47

PXA25x LCD controller driver는 module일 때 `options=<OPTIONS>`, built-in일 때 `video=pxafb:<OPTIONS>`로 설정합니다. 예시는 `modprobe pxafb options=vmem:2M,mode:640x480-8,passive`와 `video=pxafb:vmem:2M,mode:640x480-8,passive`입니다.

`vmem:VIDEO_MEM_SIZE`는 K 또는 M suffix를 쓸 수 있는 video memory 할당량입니다. `mode:XRESxYRES[-BPP]`에서 `XRES == LCCR1_PPL + 1`, `YRES == LLCR2_LPP + 1`이고 유효한 BPP는 1, 2, 4, 8, 16입니다.

`pixclock:PIXCLOCK`은 picosecond 단위 pixel clock입니다. horizontal margin은 `left == LCCR1_BLW + 1`, `right == LCCR1_ELW + 1`, `hsynclen == LCCR1_HSW + 1`입니다. vertical timing은 `upper == LCCR2_BFW`, `lower == LCCR2_EFR`, `vsynclen == LCCR2_VSW + 1`입니다.

pxafb 기본 timing
옵션register 관계의미
`vmem`-video memory 크기
`XRES``LCCR1_PPL + 1`수평 픽셀
`YRES``LCCR2_LPP + 1`수직 행
`left``LCCR1_BLW + 1`왼쪽 margin
`right``LCCR1_ELW + 1`오른쪽 margin
`hsynclen``LCCR1_HSW + 1`HSYNC 길이
`upper``LCCR2_BFW`위 margin
`lower``LCCR2_EFR`아래 margin
`vsynclen``LCCR2_VSW + 1`VSYNC 길이

================================
Driver for PXA25x LCD controller
================================

The driver supports the following options, either via
options=<OPTIONS> when modular or video=pxafb:<OPTIONS> when built in.

For example::

        modprobe pxafb options=vmem:2M,mode:640x480-8,passive

or on the kernel command line::

        video=pxafb:vmem:2M,mode:640x480-8,passive

vmem: VIDEO_MEM_SIZE

        Amount of video memory to allocate (can be suffixed with K or M
        for kilobytes or megabytes)

mode:XRESxYRES[-BPP]

        XRES == LCCR1_PPL + 1

        YRES == LLCR2_LPP + 1

                The resolution of the display in pixels

        BPP == The bit depth. Valid values are 1, 2, 4, 8 and 16.

pixclock:PIXCLOCK

        Pixel clock in picoseconds

left:LEFT == LCCR1_BLW + 1

right:RIGHT == LCCR1_ELW + 1

hsynclen:HSYNC == LCCR1_HSW + 1

upper:UPPER == LCCR2_BFW

lower:LOWER == LCCR2_EFR

vsynclen:VSYNC == LCCR2_VSW + 1

        Display margins and sync times

panel 유형과 signal polarity

48-83

`color` 또는 `mono`는 `LCCR0_CMS`를 설정합니다. `active` 또는 `passive`는 `LCCR0_PAS`를 통해 active TFT와 passive STN display를 선택합니다.

`single` 또는 `dual`은 `LCCR0_SDS`로 passive display의 single/dual panel을 고릅니다. `4pix` 또는 `8pix`는 `LCCR0_DPD`로 monochrome single panel data의 픽셀 폭을 선택합니다.

`hsync:HSYNC`, `vsync:VSYNC`에서 0은 active low, 1은 active high입니다. `dpc:DPC`는 double pixel clock으로 1=true, 0=false입니다.

`outputen:POLARITY`는 Output Enable polarity로 0=active low, 1=active high입니다. `pixclockpol:POLARITY`는 pixel clock polarity이며 0=falling edge, 1=rising edge입니다.

PXA LCD signal 옵션
옵션register
`color`/`mono``LCCR0_CMS`color 또는 monochrome
`active`/`passive``LCCR0_PAS`TFT 또는 STN
`single`/`dual``LCCR0_SDS`passive panel 수
`4pix`/`8pix``LCCR0_DPD`monochrome data 폭
`hsync`, `vsync`-0 active-low, 1 active-high
`dpc`-double pixel clock
`outputen`-output enable polarity
`pixclockpol`-0 falling, 1 rising edge


color | mono => LCCR0_CMS

        umm...

active | passive => LCCR0_PAS

        Active (TFT) or Passive (STN) display

single | dual => LCCR0_SDS

        Single or dual panel passive display

4pix | 8pix => LCCR0_DPD

        4 or 8 pixel monochrome single panel data

hsync:HSYNC, vsync:VSYNC

        Horizontal and vertical sync. 0 => active low, 1 => active
        high.

dpc:DPC

        Double pixel clock. 1=>true, 0=>false

outputen:POLARITY

        Output Enable Polarity. 0 => active low, 1 => active high

pixclockpol:POLARITY

        pixel clock polarity
        0 => falling edge, 1 => rising edge

PXA27x overlay 형식과 메모리 제약

84-132

PXA27x 이후 controller는 base framebuffer 위 또는 아래에 overlay1과 overlay2를 지원합니다. palette와 non-palette RGB, overlay2 전용 YUV 형식을 제공하며 전용 DMA channel을 갖고 framebuffer와 비슷하게 동작합니다.

overlay는 base framebuffer 안의 32-bit word aligned 위치에서 시작할 수 있어 시작 `(x,y)`를 갖습니다. 이 정보는 `var->xoffset`, `var->yoffset`이 아니라 `var->nonstd`에 encode합니다.

overlay memory는 지정한 `struct fb_var_screeninfo`에 따라 `var->xres_virtual * var->yres_virtual * bpp`로 동적 할당합니다. bpp는 RGB565/RGBT555 16, YUV444 packed 24, YUV444 planar 24, YUV422 planar 16, YUV420 planar 12입니다.

x 방향 panning은 지원하지 않으므로 `var->xres_virtual == var->xres`입니다. line length는 32-bit word boundary에 맞아야 하며 YUV planar는 최소 bpp component 기준으로 정렬합니다. 예를 들어 YUV420의 Cr은 pixel당 2 bit이므로 line length가 16 pixel 배수여야 합니다.

시작 수평 위치 XPOS도 32-bit word boundary여야 하며 아니면 `fb_check_var()`가 실패합니다. overlay rectangle은 base plane 안에 있어야 합니다.

PXA overlay pixel format
형식할당 bpp비고
RGB565/RGBT55516RGB
YUV444 packed24overlay2
YUV444 planar24overlay2
YUV422 planar161Y + 1/2Cb + 1/2Cr
YUV420 planar121Y + 1/4Cb + 1/4Cr

Overlay Support for PXA27x and later LCD controllers
====================================================

  PXA27x and later processors support overlay1 and overlay2 on-top of the
  base framebuffer (although under-neath the base is also possible). They
  support palette and no-palette RGB formats, as well as YUV formats (only
  available on overlay2). These overlays have dedicated DMA channels and
  behave in a similar way as a framebuffer.

  However, there are some differences between these overlay framebuffers
  and normal framebuffers, as listed below:

  1. overlay can start at a 32-bit word aligned position within the base
     framebuffer, which means they have a start (x, y). This information
     is encoded into var->nonstd (no, var->xoffset and var->yoffset are
     not for such purpose).

  2. overlay framebuffer is allocated dynamically according to specified
     'struct fb_var_screeninfo', the amount is decided by::

        var->xres_virtual * var->yres_virtual * bpp

     bpp = 16 -- for RGB565 or RGBT555

     bpp = 24 -- for YUV444 packed

     bpp = 24 -- for YUV444 planar

     bpp = 16 -- for YUV422 planar (1 pixel = 1 Y + 1/2 Cb + 1/2 Cr)

     bpp = 12 -- for YUV420 planar (1 pixel = 1 Y + 1/4 Cb + 1/4 Cr)

     NOTE:

     a. overlay does not support panning in x-direction, thus
        var->xres_virtual will always be equal to var->xres

     b. line length of overlay(s) must be on a 32-bit word boundary,
        for YUV planar modes, it is a requirement for the component
        with minimum bits per pixel,  e.g. for YUV420, Cr component
        for one pixel is actually 2-bits, it means the line length
        should be a multiple of 16-pixels

     c. starting horizontal position (XPOS) should start on a 32-bit
        word boundary, otherwise the fb_check_var() will just fail.

     d. the rectangle of the overlay should be within the base plane,
        otherwise fail

overlay ioctl 순서와 `var->nonstd` bitfield

133-173

응용 프로그램은 `/dev/fb1` 또는 `/dev/fb2`를 열고 `FBIOGET_VSCREENINFO`로 `var`를 읽습니다. `var->xres`, `var->yres`, double buffering에 필요한 더 큰 `var->yres_virtual`, 시작 위치와 color format용 `var->nonstd`, RGB mode의 `var->{red, green, blue, transp}`를 수정합니다.

그 뒤 `FBIOPUT_VSCREENINFO`, `FBIOGET_FSCREENINFO`, `mmap` 순서로 overlay를 준비합니다.

YUV planar format은 framebuffer framework가 직접 지원하지 않으므로 응용 프로그램이 framebuffer 안에서 각 component의 offset과 length를 관리해야 합니다.

`var->nonstd`는 상위 unused bit, 3-bit `FOR`, 10-bit `XPOS`, 10-bit `YPOS`로 구성됩니다. 원문의 ASCII bitfield를 아래 표로 같은 bit 배치가 드러나게 다시 구성했습니다.

`FOR`는 `pxafb.h`의 `OVERLAY_FORMAT_*`로 정의된 color format입니다. 0=RGB, 1=YUV444 PACKED, 2=YUV444 PLANAR, 3=YUV422 PLANAR, 4=`YUR420 PLANAR`입니다. 원문의 `YUR420` 철자를 보존합니다. `XPOS`와 `YPOS`는 시작 수평·수직 위치입니다.

PXA overlay 설정 순서
`open("/dev/fb[1-2]")``FBIOGET_VSCREENINFO``var` 해상도·위치·format 수정`FBIOPUT_VSCREENINFO``FBIOGET_FSCREENINFO``mmap`

가변 정보 설정 뒤 고정 정보를 얻어 memory map합니다.

`var->nonstd` bitfield
bit 범위field의미
31..23unused사용하지 않음
22..20`FOR`overlay color format
19..10`XPOS`시작 수평 위치
9..0`YPOS`시작 수직 위치

   Applications should follow the sequence below to operate an overlay
   framebuffer:

       a. open("/dev/fb[1-2]", ...)
       b. ioctl(fd, FBIOGET_VSCREENINFO, ...)
       c. modify 'var' with desired parameters:

          1) var->xres and var->yres
          2) larger var->yres_virtual if more memory is required,
             usually for double-buffering
          3) var->nonstd for starting (x, y) and color format
          4) var->{red, green, blue, transp} if RGB mode is to be used

       d. ioctl(fd, FBIOPUT_VSCREENINFO, ...)
       e. ioctl(fd, FBIOGET_FSCREENINFO, ...)
       f. mmap
       g. ...

3. for YUV planar formats, these are actually not supported within the
   framebuffer framework, application has to take care of the offsets
   and lengths of each component within the framebuffer.

4. var->nonstd is used to pass starting (x, y) position and color format,
   the detailed bit fields are shown below::

    31                23  20         10          0
     +-----------------+---+----------+----------+
     |  ... unused ... |FOR|   XPOS   |   YPOS   |
     +-----------------+---+----------+----------+

   FOR  - color format, as defined by OVERLAY_FORMAT_* in pxafb.h

        - 0 - RGB
        - 1 - YUV444 PACKED
        - 2 - YUV444 PLANAR
        - 3 - YUV422 PLANAR
        - 4 - YUR420 PLANAR

   XPOS - starting horizontal position

   YPOS - starting vertical position