Presentation is loading. Please wait.

Presentation is loading. Please wait.

S3c6410을 이용한 리눅스 비디오 드라이버 포팅 가이드 – - Linux Video Driver Porting Guide Using s3c6410 – 박영만 yucco@naver.com.

Similar presentations


Presentation on theme: "S3c6410을 이용한 리눅스 비디오 드라이버 포팅 가이드 – - Linux Video Driver Porting Guide Using s3c6410 – 박영만 yucco@naver.com."— Presentation transcript:

1 s3c6410을 이용한 리눅스 비디오 드라이버 포팅 가이드 – - Linux Video Driver Porting Guide Using s3c6410 –
박영만

2 Contents Overview Framebuffer Controller Pannel Backlight
Video Driver Concept Video Driver Architecture Framebuffer Framebuffer Information Linux Framebuffer Driver Color Format Controller Overlay Alpha Blending Chroma Key (Color Key) Alpha Blending & Chroma Key Pannel Backlight Porting Sequence

3 Video Driver Concept Video 입출력을 지원하는 가장 Low Level의 S/W
Video Driver의 구성 Module Controller ex) Display Controller, Graphic Card … Pannel ex) LCD, AMOLED, CRT … Framebuffer ex) Overlay 1, 2 … ※ SRAM을 의미함 Controller가 Framebuffer의 Data를 Pannel에 출력한다. 일반적으로 Framebuffer Driver 로 불리기도 함 Framebuffer Controller Pannel

4 Video Driver Architecture
※ 본 구조는 s3c6410 코드를 기반으로 작성된 것임. 코드에 따라 BSP 구조는 바뀔 수 있음. User System Call Kernel fbmem.c/fb.h 과 같은 커널의 Abstract Driver Framebuffer Controller Pannel BSP H/W /dev/fb0, 1… N과 같이 Framebuffer 개수에 따라 여러 Device Node로 나누어질 수 있음

5 Framebuffer 실제 화면에 출력되게 될 메모리 영역 Framebuffer Module
Framebuffer 에 Data를 작성화면, 작성된 Data는 Controller에 의해 Pannel에 출력되게 된다. Framebuffer Module 커널에 포함되는 실제 Driver 모듈 Framebuffer module의 probe 함수가 호출되면서 driver 가 커널에 등록된다. SRAM에 Framebuffer 영역을 할당한다. dma_alloc_writecombine(device, memory_size, physical_memory_address, option) 으로 할당 ※ Framebuffer는 연속적인 Memory 영역을 가져야하기 때문에 dma_alloc_writecombine 으로 할당해야 한다. Framebuffer 정보를 설정한다. ex) bpp, width, height 정보 기본적인 framebuffer 정보는 커널이 초기화되는 시점에 미리 할당되나, Driver 가 올라간 후 부터는 Framebuffer module 에서 변경된 정보를 처리한다. Controller/Pannel 모듈 관리. + Backlight 실제로 Operation을 처리하는 Module은 Controller와 Pannel이지만 User level 에서는 Framebuffer Module을 통해 Controller와 Pannel을 Access 하게 된다. (Backlight 도 경우에 따라 Framebuffer에서 관리한다.) 또한 Framebuffer Module의 초기화 부분에서 Controller와 Pannel의 초기화 함수를 호출한다.

6 Framebuffer Information
※ Pixel Clock : 1 Pixel 을 그리는 데 걸리는 시간 (Pico second) ex ) Dot Clock 이 60MHz 라고 하면 pixclock = 1/60 * pixclock xres yres bpp hsync_len left_margin right_margin vsync_len upper_margin lower_margin backlight_power lcd_power upper margin left margin right margin hsync len xres yres ※ 함수 포인터로 관련 Operation 이 붙는다. lower margin vsync len

7 Linux Framebuffer Driver
include/linux/fb.h 커널 내 Abstract Display Driver User Level 에게 표준화된 Interface 를 제공. struct fb_var_screeninfo { __u32 xres; /* Visible resolution in the X axis */ __u32 yres; /* Visible resolution in the Y axis */ /* ... */ __u32 bits_per_pixel; /* Number of bits required to hold a pixel */ __u32 pixclock; /* Pixel clock in picoseconds */ __u32 left_margin; /* Time from sync to picture */ __u32 right_margin; /* Time from picture to sync */ __u32 hsync_len; /* Length of horizontal sync */ __u32 vsync_len; /* Length of vertical sync */ }; fbmem.c fb.h fb core struct fb_fix_screeninfo { char id[16]; /* Identification string */ unsigned long smem_start; /* Start of frame buffer memory */ __u32 smem_len; /* Length of frame buffer memory */ /* ... */ }; fb driver 1 fb driver N struct fb_cmap { __u32 start; /* First entry */ __u32 len; /* Number of entries */ __u16 *red; /* Red values */ __u16 *green; /* Green values */ __u16 *blue; /* Blue values */ __u16 *transp; /* Transparency. Discussed later on */ }; Memory 1 Memory N ※ 1개의 Device 가 여러 Memory(FB) 를 가질 수 있다.

8 Color Format RGB ….. Palletized : Pallet를 통해 색상정보를 출력함.
RGB 값이 Pallet의 Index를 의미함. ex) RGB 값이 3일 경우 Pallet 의 3번 색상을 출력. Non-Palletized : RGB 값이 하나의 색상정보를 의미함. R : 0 G : 1 B : 1 0번 색 1번 색 2번 색 3번 색 4번 색 5번 색 6번 색 7번 색 8번 색 ….. ※ Pallet 또한 Framebuffer 의 한 메모리 영역임.

9 Color Format YUV Y U V Y U V Y U V
일반적으로 YUV포맷 데이터는 Framebuffer 가 아닌 외부 장치(Camera등)에서 바로 넘어오는 경우가 많다. YUV Format YUV444 (24bpp) YUV422 (16bpp) YUV420 (12bpp) Y U V ※ YUV pixel packing format Y U V Planar Format Y Y Y Y Y Y ….. U U U U U U ….. V V V V V V ….. Y Packed Format U V YUV YUV YUV YUV YUV YUV …..

10 Controller 프레임버퍼의 내용(Data)을 화면(Pannel)에 출력할 수 있도록 지원해주는 Device
오버레이(Overlay), 크로마 키(Chroma Key)등의 효과를 H/W적으로 지원 컨트롤러의 사용 GPIO : LCD GPIO의 설정 ex) Input / Output PIN REGISTER : REGISTER 를 이용하여 컨트롤러를 제어할 수 있다.

11 Controller s3c6410 관련 Reigster Register Description MFPCON
BY PASS & Normal Mode 선택 SPCON Host I/F & RGB I/F 선택 VIDCON0 출력 Format 및 Display enable/disable 설정 VIDCON1 RGB I/F control signal I80IFCONx I80-system I/F signal ITUIFCON0 ITU (BT.601) Interface Control VIDTCONx 출력 Timing 및 화면 size 설정 WINCONx 출력 Layer 별 Format 설정 VIDOSDxA, VIDOSDxB 화면 위치 설정 VIDOSDxC Alpha 값 설정 (for Alpha Blending) VIDWxxADDx Source Image Address 설정 WxKEYCONx Color key 값 설정 WINxMAP 화면 Color 제어 WPALCON Palette 제어 WxPDATAxx Window Palette Data of the each Index ※ ‘x’는 0, 1, 2 … 로 확장됨을 의미함. ex) VIDTCONx : VIDTCON0, VIDTCON1, VIDTCON2 ….

12 Overlay 화면의 중첩 H/W 따라 Overlay 정보 및 제어방법이 달라짐 Memory (Framebuffer)
첫 번째 화면 (Base) fb0 fb1 두 번째 화면 (Overlay 1) 세 번째 화면 (Overlay 2) fb2

13 Overlay s3c6410 스펙 s3c6410 관련 Register 5 개의 화면 지원 (1 Base 4 Overlay)
Layer 0, 1, 2 : Main Layer (화면) 1, 2, 4 or 8-BPP (bit per pixel) palletized color 16, 18 or 24-BPP non-palletized color YCbCr (4:4:4) 로컬 버스로부터 직접 입력을 받음 (Win 0 :Post Processor. Win 1,2 :TV scaler) RGB (8:8:8) 로컬 버스로부터 직접 입력을 받음 (Win 0 :Post Processor. Win 1,2 :TV scaler) Layer 3, 4 : Sub Layer (자막, 커서) 1, 2 or 4-BPP (bit per pixel) palletized color 화면 순위 (고정) Layer 5 > Layer 4 > Layer 3 > Layer 2 > Layer1 s3c6410 관련 Register WINCONx 0x ~ 출력 Layer 별 Format 설정

14 Alpha Blending 투명 효과 (Transparency Effect) ARGB Color Format 이용 ARGB
A : Alpha Channel (투명도를 나타냄) s3c6410 관련 Register Alpha Blending 기능 설정 Alpha 값 셋팅 A R G B WINCONx 출력 Layer 별 Format 설정 VIDOSDxC Alpha 값 설정 (for Alpha Blending)

15 Chroma key Chroma Key 를 적용하여 특정 이미지를 제거 함 s3c6410 관련 Register
WxKEYCONx Color key 값 설정 Layer 0 Layer 1

16 Alpha Blending & Chroma key
s3c6410 관련 Register WxKEYCONx Color key 값 설정

17 Virtual Screen 실제 보여질 수 있는 화면(Pannel Size)보다 더 큰 영상을 보여줄 때 사용
s3c6410 관련 Register VIDWxxADDx Source Image Address 설정 ※ 위 Register의 VBASEU_F 값과 VBASEL_F 값에 따라 보여지는 화면의 위치가 변경된다. LCDBASEU LCDBASEL

18 Pannel Timing sequence
Pannel On/Off 에 대한 Timing sequence가 존재함. (Pannel 매뉴얼이 별도로 존재) Timing sequence 에 맞게 On/Off 가능한 함수를 만든 후 fb_info(Framebuffer Information) 구조체에 삽입해서 컨트롤 ex ) < xxx.h > struct fb_info { .... void (*lcd_power)(int); } < xxx.c > probe() // 초기화 함수 { ….. fb->lcd_power = pannel 함수; ※ Timing - 전류의 흐름을 시간 간격에 따라 High 로 해줄 것인지 low 로 해줄 것인지를 나타냄 - 위 그림에서는 xcs, sclk, si 3핀간의 Timing 값을 보여준다.

19 Backlight 화면의 밝기 조정 PWM(Pulse-Width Modulation Unit) 을 이용 기능 구현 방법
Framebuffer Driver 에 삽입하는 방법 : Framebuffer Driver 에서 직접 PWM을 컨트롤 Backlight Driver 를 별도로 구현하는 방법 : Backlight Driver 작성 후 Backlight Driver에서 PWM 컨트롤 ※ Backlight Driver 구조 & 제어 방법 drivers/video/backlight/backlight.c Backlight core Core에서 제공하는 sysfs 인터페이스 제공 ex ) /sys/s3c-bl/brightness Backlight Driver Core에서 제공하는 sysfs 인터페이스에 실제 동작을 연결 PWM(H/W)

20 Porting Sequence 커널 초기화 부분에 Video Driver와 관련된 기본 값을 설정한다.
※ 기본적으로 GPIO PIN 과 Register의 Physical Address는 정의되어 있다고 가정함 커널 초기화 부분에 Video Driver와 관련된 기본 값을 설정한다. (일반적으로 fb_info 구조체를 만들어 기본 값들을 셋팅한다.) Driver가 Kernel에 삽입될 수 있도록 Linux Device Driver Model에 맞는 구조를 잡는다. (platform_device / platform_driver 구조체 선언 및 셋팅) ※ 기본적으로 platform_device 는 커널 초기화 부분에서, platform_driver 는 framebuffer module에서 선언된다. Driver가 초기화될 때 일어나야 할 일들을 probe에 순서대로 작성한다. (Framebuffer 할당 및 초기화, gpio 및 register 셋팅, driver 등록) 추가적인 사항 작성 (ioctl 등… ) ※ s3c6410 video driver 기본 구조 Framebuffer alloc s3cfb.c fimd4xx.c s3cfb_xxx.c Controller Pannel


Download ppt "S3c6410을 이용한 리눅스 비디오 드라이버 포팅 가이드 – - Linux Video Driver Porting Guide Using s3c6410 – 박영만 yucco@naver.com."

Similar presentations


Ads by Google