한국어
Qt
 

Mobile and Embedded QtWayland와 ivi-compositor

makersweb 2018.12.27 20:48 조회 수 : 2399

우선 wayland에 관한 설명은 다음 글을(Wayland에 대한 간단한 소개) 참고하자.

 

QtWayland 모듈은 Wayland의 기능을 사용할 수 있도록 API를 제공한다. 다만 아직은 maintenance tool로 제공되진 않고 직접 컴파일 및 설치해야한다. 

 

QtWayland는 클라이언트와 서버 측으로 구분되는데, 클라이언트 측은 wayland 플랫폼 플러그인(QPA)이며 Wayland 클라이언트로 Qt 응용 프로그램을 실행한다. 서버 측은 Qt Wayland Compositor API이며 이를 이용하여 사용자가 Wayland 컴포지터를 개발할 수 있다.  C++ API뿐만 아니라 Qml로도 컴포지터를 개발할 수 있도록 하였는데 C++및 Qml로 개발된 몇가지 컴포지터 예제를 제공한다. 

 

이글에선 qtwayland 컴포지터 예제중 Qml로된 ivi-compositor를 테스트 해보고자 한다.

 

ivi는 무엇?

자동차 인포테인먼트 (in-vehicle infotainment) 시스템을 말한다. infotainment는 information 과 entertainment의 합성어인데 즉, 차안에서 정보와 오락등 편의를 제공하는 시스템을 통칭해서 그렇게 부른다. 커넥티드카, 자율주행등등과 더불어 자동차 분야에서 점차 더발전하게될 디지털 콕핏을 구현한다.

 

ivi-compositor는 Weston 레퍼런스구현의 ivi-shell을 사용하여 셸 프로토콜이 ivi-application.xml인 surface를 관리하는데, IVI-System 특유의 요구사항을 구현하기위한 컴포지터로 이해하면된다. 아래표는 IVI-System과와 범용적이고 일반적인 시스템을 비교한 것이다.

 

Personal Computer

Tablet/ Smartphone

IVI-System

Window 사이즈 및 위치

자유로움

고정되거나 제한적

고정됨

Window 관리

사용자

전용 관리자 또는 사용자 제한적임

전용 관리자

계층적 개념

요구됨

요구됨

요구됨

멀티 스크린 / 입력장치

복제 / 확장

 

별도 관리

 

아직까진 IVI-System에서의 window사용성은 제한적인 부분이 많음을 알 수 있다.

 

참고로 Wayland IVI Extension 은 GENIVI 프로젝트의 일부이며 아래 주소를 방문하면 자세한 정보를 얻을 수 있다. 

https://at.projects.genivi.org/wiki/display/WIE/Wayland+IVI+Extension+Home

 

아래 화면은 ivi-compositor를 실행한 화면이다. 좌측 영역은 ivi-application 프로토콜로 1337이라는 id의 ivi 전용 surface를 위한 것이고 오른쪽은 일반 surface를 위한 영역이다. 이것은 어떤 특정 상황에 따라 특정 surface를 제어한다는 것을 의미한다. 위에 설명한 IVI-System 특성을 이해 할 수 있다. 

ivi-compositor.png

 

사실 ivi-compositor는 아주 단순한 예제에 불과하다. 실제로는 멀티 스크린, layer, surface, 그리고 여러가지 요구사항에 따라 복잡해 질 것이다.

 

그러면 이제 QtWayland를 컴파일 해보고 ivi-compositor를 실행해 보자. 

 

Ubuntu 16.04에서 Qt5.9.4를 설치하였으며 아래의 패키지들이 필요할 수 있다.

libwayland-dev
libwayland-egl1-mesa
libwayland-server0
libgles2-mesa-dev
libxkbcommon-dev

 

QtWayland 소스코드를 준비. (설치된 Qt버전에 맞는 브랜치로 체크아웃.)

pjk@ubuntu:~/workspace$ git clone git://code.qt.io/qt/qtwayland.git
pjk@ubuntu:~/workspace$ cd qtwayland/
pjk@ubuntu:~/workspace/qtwayland$ sudo apt install g++
pjk@ubuntu:~/workspace/qtwayland$ git checkout v5.9.4
Note: checking out 'v5.9.4'.
 
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
 
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
 
  git checkout -b <new-branch-name>
 
HEAD is now at 83db09b... Fix static builds with libwayland-egl

 

qmake 및 빌드.

pjk@ubuntu:~/workspace/qtwayland$ /opt/Qt5.9.4/5.9.4/gcc_64/bin/qmake
Info: creating stash file /home/pjk/workspace/qtwayland/.qmake.stash
Info: creating cache file /home/pjk/workspace/qtwayland/.qmake.cache
 
Running configuration tests...
Checking for Wayland client library... yes
Checking for Wayland cursor library... yes
Checking for wayland-scanner... yes
Checking for DRM EGL Server... yes
Checking for libhybris EGL Server... no
Checking for Wayland EGL library... yes
Checking for XComposite... no
Checking for wayland-server... yes
Done running configuration tests.
 
Configure summary:
 
Qt Wayland Drivers:
  EGL .................................... yes
  Raspberry Pi ........................... no
  XComposite EGL ......................... no
  XComposite GLX ......................... no
  DRM EGL ................................ yes
  libhybris EGL .......................... no
Qt Wayland Client ........................ yes
Qt Wayland Compositor .................... yes
 
Qt is now configured for building. Just run 'make'.
Once everything is built, Qt is installed.
You should NOT run 'make install'.
Note that this build cannot be deployed to other machines or devices.
 
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
 
 
pjk@ubuntu:~/workspace/qtwayland$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.9.4/5.9.4/gcc_64/lib
pjk@ubuntu:~/workspace/qtwayland$ make
pjk@ubuntu:~/workspace/qtwayland$ sudo make install

 

ivi-compositor 예제는 examples 디렉토리에 있다.

ivi-comporsitor디렉토리에서 qmake하고 빌드한다.

pjk@ubuntu:~/workspace/qtwayland$ cd examples/wayland/ivi-compositor/
pjk@ubuntu:~/workspace/qtwayland/examples/wayland/ivi-compositor$ /opt/Qt5.9.4/5.9.4/gcc_64/bin/qmake
pjk@ubuntu:~/workspace/qtwayland/examples/wayland/ivi-compositor$ make

 

빌드가 완료되면 다음과 같이 ivi-compositor를 실행할 수 있다. (아래 옵션은 x기반의 ubuntu를 위한 옵션이다)

QT_XCB_GL_INTEGRATION=xcb_egl QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=xcomposite-egl ./ivi-compositor

 

그다음 Qt 응용프로그램을 클라이언트로 실행하기위해 -platform wayland 옵션으로 실행시킨다. 그러면 아래 화면과 같이 ivi surface를 위해 별다른 작업을 해주지 않았으므로 오른쪽 영역에 표시된다.

ivi-compositor_1.png

 

클라이언트 응용프로그램을 종료하고 QT_WAYLAND_SHELL_INTEGRATIONQT_IVI_SURFACE_ID 환경변수를 설정하고 다시 실행시켜본다. QT_WAYLAND_SHELL_INTEGRATION는 ivi-shell을 설정하고 QT_IVI_SURFACE_ID에는 1337을 설정해준다.

 

이를테면 아래 화면과 같다.

env.png

 

위와 같이 환경변수 설정 후 클라이언트 응용프로그램을 실행시켜보면 ivi-compositor의 왼쪽 영역에 나타나는 것을 확인 할 수 있다.

ivi_surface.png

 

QtWayland API와 제공되는 예제를 이용하여 멀티 윈도우, 프로세스가 요구되는 임베디드 시스템에서 쉽게 구현가능하다.

번호 제목 글쓴이 날짜 조회 수
공지 Qt프로그래밍(QtQuick) Beginner를 위한 글 읽는 순서 운영자 2019.01.05 85726
78 QSocketNotifier로 파일 디스크립터의 활동감지 makersweb 2019.08.28 1728
77 MCU용 Qt에 대해서 makersweb 2019.08.22 1910
76 [Qt News] Qt for Python을 위한 기술 비전 j2doll 2019.08.20 1624
75 열거형(enum)을 QML에서 사용하는 방법과 문자열(QString)로 얻기 makersweb 2019.08.20 3874
74 [Qt News] Qt 6 기술 비전 (Technical vision for Qt 6) [2] j2doll 2019.08.08 2111
73 [Qt News] Qt6 Git 개발 초기 단계 시작하기 j2doll 2019.08.02 2328
72 [Qt] Google Play의 향후 요구 사항을 준수하는 방법 [2] j2doll 2019.07.29 972
71 Qt기반의 오픈소스 프로젝트들 - 2 운영자 2019.07.21 4002
70 QML, 이미지, 폰트등을 바이너리 리소스로 만들기 makersweb 2019.06.24 3499
69 Qt Creator에서 임베디드 장치로 deploy설정(Custom Process Step) file makersweb 2019.06.15 2197
68 Qt Quick Controls 2사용 및 스타일 설정 file makersweb 2019.06.07 6233
67 QML 강좌 - 동적 Listing (ListView) file makersweb 2019.06.01 10074
66 QtInstallerFramework로 온라인 설치프로그램(Online Installer)만드는 방법 [4] file makersweb 2019.05.28 6248
65 QtCreator Design으로 GUI만들기 (QML로 만드는 Hello World -2) [1] file makersweb 2019.05.26 14837
64 QML에서 멀티 스레드(multithreading) 프로그래밍 file makersweb 2019.05.25 2650
63 QtSerialPort를 사용한 시리얼(Serial)통신 [3] makersweb 2019.05.21 11864
62 Qt기반의 오픈소스 프로젝트들 makersweb 2019.05.15 5406
61 Q_D매크로와 d-pointer file makersweb 2019.05.07 758
60 가상키보드(Qt Virtual Keyboard)를 사용하는 방법 [32] file makersweb 2019.05.03 220761
59 Windows에서 Qt D-Bus를 사용하여 프로세스간 통신(IPC) file makersweb 2019.05.02 4467