한국어
Qt
 

Mobile and Embedded QtWayland와 ivi-compositor

makersweb 2018.12.27 20:48 조회 수 : 2395

우선 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 85363
136 멀티 스레드환경, 스레드에 안전한 이벤트처리 makersweb 2016.10.27 4933
135 C++로 구현된 모델을 QML의 ListView에서 참조 file makersweb 2019.09.07 4883
134 Qml 기본 컴포넌트 강좌 (3) - 배치(positioning) 컴포넌트 file 운영자 2019.02.10 4823
133 Qt 멀티 스레드 프로그래밍 시 유의해야 할 몇 가지 makersweb 2020.01.13 4804
132 QNetworkAccessManager를 통해 HTTP POST 하는 예제 makersweb 2019.01.17 4718
131 Qt응용프로그램 실행 시 콘솔창(터미널)같이 띄우기 file makersweb 2019.01.16 4441
130 라즈베리파이4에 대한 Qt 5.14.1 크로스컴파일 [1] file makersweb 2020.02.12 4440
129 Windows에서 Qt D-Bus를 사용하여 프로세스간 통신(IPC) file makersweb 2019.05.02 4435
128 QML에서 동적으로 텍스트 다국어 처리 file makersweb 2018.11.04 4164
127 Qt기반의 오픈소스 프로젝트들 - 2 운영자 2019.07.21 3991
126 QPA 플러그인과 EGLFS file makersweb 2017.11.21 3899
125 열거형(enum)을 QML에서 사용하는 방법과 문자열(QString)로 얻기 makersweb 2019.08.20 3836
124 Qt 3D Studio 시작하기 file makersweb 2018.01.11 3804
123 Qt 를 사용하거나 기반으로 하는 응용프로그램 file makersweb 2021.01.30 3711
122 QML에서 앵커(anchors)로 위치 지정 file makersweb 2021.10.05 3704
121 Qt Logging Rule, Qt 프레임워크 로그 출력 makersweb 2017.01.13 3672
120 Qml에서 키보드 입력 이벤트 핸들링 file makersweb 2018.08.09 3541
119 Qt Bluetooth를 이용한 시리얼(Serial) 통신 file makersweb 2019.02.17 3496
118 Qt Version확인 방법 makersweb 2018.03.29 3488
117 QML, 이미지, 폰트등을 바이너리 리소스로 만들기 makersweb 2019.06.24 3460