海思Hi3516DV300 QT移植详解

海思Hi3516DV300 QT移植详解 tomato 2024-06-06 09:47:33 315

1.qt的选择与下载

wget http://download.qt.io/archive/qt/5.12/5.12.8/single/qt-everywhere-src-5.12.8.tar.xz tar xf qt-everywhere-src-5.12.8.tar.xz

2.创建海思的qmake.conf

cp /opt/qt-everywhere-src-5.12.8/qtbase/mkspecs/linux-arm-gnueabi-g++/ /opt/qteverywhere-src-5.12.8/qtbase/mkspecs/arm-himix200-linux-g++ -rf
vi /opt/qt-everywhere-src-5.12.8/qtbase/mkspecs/arm-himix200-linux-g++/qmake.conf

qmake.conf内容修改如下:

#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = arm-himix200-linux-gcc
QMAKE_CXX = arm-himix200-linux-g++
QMAKE_LINK = arm-himix200-linux-g++
QMAKE_LINK_SHLIB = arm-himix200-linux-g++
# modifications to linux.conf
QMAKE_AR = arm-himix200-linux-ar cqs
QMAKE_OBJCOPY = arm-himix200-linux-objcopy
QMAKE_STRIP = arm-himix200-linux-strip
load(qt_config)
# modifications to gcc-base.conf
QMAKE_CFLAGS_RELEASE += -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4
QMAKE_CXXFLAGS_RELEASE += -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -
fpermissive

3.开始编译

./configure -prefix ../qt5.12.8_hi3516dv300 -opensource -confirm-license -release -strip
-no-eglfs -linuxfb -qt-zlib -no-gif -qt-libpng -qt-libjpeg -qt-freetype -no-rpath -no-pch
-no-avx -no-openssl -no-cups -no-dbus -no-pkg-config -no-glib -no-iconv -xplatform armhimix200-linux-g++ -no-opengl -nomake examples -nomake tools -no-sqlite -skip qtgamepad -
skip qtandroidextras -skip qtmacextras -skip qtx11extras -skip qtsensors -skip
qtserialbus -skip qtserialport -skip qtwebengine -skip qtwebchannel -skip qtwebsockets -
skip qtlocation -skip qtquickcontrols -skip qtpurchasing -skip qtconnectivity -skip
qtscxml -skip qtxmlpatterns -skip qtnetworkauth -skip qtspeech -skip qtscript -skip
qtremoteobjects -skip qtcharts -skip qtdatavis3d -skip qtwebview
make
make install

4.海思framebuffer的qt移植

cd /opt/qt-everywhere-src-5.12.8/qtbase/src/plugins/platforms/linuxfb
vim linuxfb.pro

linuxfb.pro内容如下:

TARGET = qlinuxfb
DEFINES += QT_NO_FOREACH
QT += \
core-private gui-private \
service_support-private eventdispatcher_support-private \
fontdatabase_support-private fb_support-private
qtHaveModule(input_support-private): \
QT += input_support-private
SOURCES = main.cpp \
qlinuxfbintegration.cpp \
qlinuxfbscreen.cpp
HEADERS = qlinuxfbintegration.h \
qlinuxfbscreen.h
qtHaveModule(kms_support-private) {
QT += kms_support-private
SOURCES += qlinuxfbdrmscreen.cpp
HEADERS += qlinuxfbdrmscreen.h
}

INCLUDEPATH += /HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/include
unix:LIBS += -Wl,--start-group /HardDisk/hisilicon/hi3516dv300-ipc￾v20/smp/a7_linux/mpp/lib/libsvpruntime.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libhi_cipher.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libupvqe.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libsns_imx307_2l.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libmpi.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/lib_hiawb_natura.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/lib_hidrc.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/lib_hiawb.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libsns_imx307.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/lib_hiae.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libdnvqe.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libnnie.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libhifisheyecalibrate.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libtde.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libVoiceEngine.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libsecurec.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/lib_hildci.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libhdmi.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libmd.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libive.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/libisp.a \
/HardDisk/hisilicon/hi3516dv300-ipc-v20/smp/a7_linux/mpp/lib/lib_hidehaze.a -lm -Wl,--
end-group
OTHER_FILES += linuxfb.json
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QLinuxFbIntegrationPlugin
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
load(qt_plugin)

qlinuxfbscreen.cpp新增以下内容

#include "hi_type.h"
#include "hifb.h"
#include "mpi_vo.h"
#include "hi_comm_vo.h"
static struct fb_bitfield s_r16 = {10, 5, 0};
static struct fb_bitfield s_g16 = {5, 5, 0};
static struct fb_bitfield s_b16 = {0, 5, 0};
static struct fb_bitfield s_a16 = {15, 1, 0};
static struct fb_bitfield s_a32 = {24, 8, 0};
static struct fb_bitfield s_r32 = {16, 8, 0};
static struct fb_bitfield s_g32 = {8, 8, 0};
static struct fb_bitfield s_b32 = {0, 8, 0};
#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 1280
qInfo("FBIOGET_VSCREENINFO: %dx%d", vinfo.xres, vinfo.yres);
// add by wei
/* 1. disable HIFB show */
HI_BOOL bShow = HI_FALSE;
if (ioctl(mFbFd, FBIOPUT_SHOW_HIFB, &bShow) < 0)
{
qErrnoWarning("FBIOPUT_SHOW_HIFB failed!\n");
return false;
}
/* 2. set the screen original position */
HIFB_POINT_S stPoint = {0, 0};
if (ioctl(mFbFd, FBIOPUT_SCREEN_ORIGIN_HIFB, &stPoint) < 0)
{
qErrnoWarning("set screen original show position failed!\n");
close(mFbFd);
return false;
}
/* **********************************************************
*3. modify the variable screen info
* the screen size: IMAGE_WIDTH*IMAGE_HEIGHT
* the virtual screen size: VIR_SCREEN_WIDTH*VIR_SCREEN_HEIGHT
* (which equals to VIR_SCREEN_WIDTH*(IMAGE_HEIGHT*2))
* the pixel format: ARGB1555
**************************************************************/
HIFB_COLOR_FMT_E enClrFmt = HIFB_FMT_ARGB8888;
switch (enClrFmt)
{
case HIFB_FMT_ARGB8888:
vinfo.transp = s_a32;
vinfo.red = s_r32;
vinfo.green = s_g32;
vinfo.blue = s_b32;
vinfo.bits_per_pixel = 32;
break;
default:
vinfo.transp = s_a16;
vinfo.red = s_r16;
vinfo.green = s_g16;
vinfo.blue = s_b16;
vinfo.bits_per_pixel = 16;
break;
}
HI_BOOL bDoubleBuffer = HI_TRUE;
HI_U32 u32Width = SCREEN_WIDTH;
HI_U32 u32Height = SCREEN_HEIGHT;
switch(bDoubleBuffer)
{
case HI_FALSE:
{
vinfo.xres_virtual = u32Width;
vinfo.yres_virtual = u32Height;
vinfo.xres = u32Width;
vinfo.yres = u32Height;
}
break;
default:
{
vinfo.xres_virtual = u32Width;
vinfo.yres_virtual = u32Height * 2;
vinfo.xres = u32Width;
vinfo.yres = u32Height;
break;
}
}
vinfo.activate = FB_ACTIVATE_NOW;
/* 4. set the variable screen information */
if (ioctl(mFbFd, FBIOPUT_VSCREENINFO, &vinfo) < 0)
{
qErrnoWarning("Put variable screen info failed!\n");
close(mFbFd);
return false;
}
qInfo("FBIOPUT_VSCREENINFO: %dx%d", vinfo.xres, vinfo.yres);
/* 5. get the fix screen information */
if (ioctl(mFbFd, FBIOGET_FSCREENINFO, &finfo) < 0)
{
qErrnoWarning("Get fix screen info failed!\n");
close(mFbFd);
return false;
}
/* 6. fix some lcd color's bug */
VO_CSC_S stVoCSC;
if (HI_MPI_VO_GetGraphicLayerCSC(0, &stVoCSC) == HI_SUCCESS)
{
if(stVoCSC.enCscMatrix != VO_CSC_MATRIX_IDENTITY)
{
stVoCSC.enCscMatrix = VO_CSC_MATRIX_IDENTITY;
if(HI_MPI_VO_SetGraphicLayerCSC(0, &stVoCSC) != HI_SUCCESS)
{
qErrnoWarning("CSC failed!\n");
}
else
{
qInfo("HI_MPI_VO_SetVideoLayerCSC success!");
}
}
}
/* 7. it's time to play */
bShow = HI_TRUE;
if (ioctl(mFbFd, FBIOPUT_SHOW_HIFB, &bShow) < 0)
{
qErrnoWarning("FBIOPUT_SHOW_HIFB failed!\n");
close(mFbFd);
return false;
}
#if 0 // no need
if (ioctl(mFbFd, FBIOPAN_DISPLAY, &vinfo) < 0)
{
qErrnoWarning("FBIOPAN_DISPLAY failed!\n");
close(mFbFd);
return false;
}
#endif
qInfo("[HI3516DV300]HIFB init ok!");

重新生成liblinuxfb.so库

…/…/…/…/bin/qmake
make

将qt-everywhere-src-5.12.8/qtbase/plugins/platforms/下生成的libqlinuxfb.so拷贝到安装目录下plugins/platforms/下,替换原有liblinuxfb.so

5.编译demo

cd /opt/qt-everywhere-src-5.12.8/qtbase/examples/widgets/graphicsview/collidingmice
../../../../bin/qmake make

6.运行demo

1)打包编译好的qt
tar -czvf qt5.12.8_hi3516dv300.tgz qt5.12.8_hi3516dv300
将qt5.12.8_hi3516dv300.tgz拷贝到板端并解压
将编译好的collidingmice拷贝到板端

2)环境变量配置

export QT_QPA_PLATFORM_PLUGIN_PATH=/nfsroot/qt5.12.8_hi3516dv300/plugins
export QT_QPA_FONTDIR=/nfsroot/qt5.12.8_hi3516dv300/fonts
export QWS_MOUSE_PROTO="tslib:/dev/input/mice mouseman:/dev/input/mice"
export LD_LIBRARY_PATH=/nfsroot/qt5.12.8_hi3516dv300/lib:LD_LIBRARY_PATH
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export
QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=800x1280:offset=0x0:nographicsmodeswitch

3)运行demo

./collidingmice

参考:
https://blog.csdn.net/cocoron/article/details/105662856
https://blog.csdn.net/cocoron/article/details/105664829

声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
tomato
红包 1 收藏 评论 打赏
评论
1个
内容存在敏感词
手气红包
  • lzt404 2024-07-07 13:26:35
    回复
    请问移植QT后hdmi输出的颜色正常吗?我这边的不太正常
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
tomato
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区