weston的使用

0.设置配置文件/etc/xdg/weston/weston.ini文件内容如下:

[core]
# Boards could have not any input device, and only use
# removable input device like usb(keyboard, mouse).
require-input=false
[output]
name=DSI-1
transform=0
[shell]
# 480x800
background-image=/oem/yd_rootfs_background.png
# scale, scale-crop or tile(default)
background-type=scale-crop
panel-position=none
# fade(default),none
#close-animation=none
# The hexadecimal digit pairs are in order alpha, red, green, and blue.
background-color=0x00ffffff

备注:
(1)name的查看:ls /sys/class/drm/ --> 名字即为DPI-1
	card0  card0-DPI-1  controlD64  renderD128  version
(2)transform::旋转角度
(3)background-image:背景图片
(4)background-color:背景颜色
# The hexadecimal digit pairs are in order alpha, red, green, and blue.
background-color=0x00ff0000 --> 不显示
background-color=0xffff0000 --> 显示红色
alpha:00-全透明 ff-不透明

background-color表示背景颜色,这里设置为0x00FFFFFF,表示完全透明,即没有该背景图

1.运行服务端程序

#如果想到手动启动weston程序,需要导出以下环境变量,weston程序才能够运行起来

#for waylandsink
export QT_GSTREAMER_WINDOW_VIDEOSINK=waylandsink
#非必要
export QT_GSTREAMER_WIDGET_VIDEOSINK=waylandsink

#导出该变量后,默认启动QT程序是采用的gpu方式,而非cpu方式,如果不设置默认会走cpu方式,否则只能使用./test -platform wayland 或者 ./test -platform linuxfb来运行程序,导出后./test == ./test -platform wayland
export QT_QPA_PLATFORM=wayland
#渲染是通过DRM API设置
export QT_QPA_FB_DRM=1

#for dual display with morror mode by default
export WESTON_DRM_MIRROR=1
export WESTON_DRM_KEEP_RATIO=1

#非必要
export WESTON_DISABLE_ATOMIC=1

#for QLauncher wayland
mkdir -p /tmp/.xdg &&  chmod 0700 /tmp/.xdg
export XDG_RUNTIME_DIR=/tmp/.xdg

# 运行服务端程序
weston --tty=2 -B=drm-backend.so --idle-time=0

2.屏幕冻结及解冻

作用:在weston启动时,在启动图标和UI显示屏之间短暂切换时会出现黑屏,如果需要方式黑屏,可以通过以下动态配置文件方法临时冻结weston屏幕内容

export WESTON_FREEZE_DISPLAY=/tmp/.weston_freeze # Set the path of the special configuration file
#冻结屏幕
touch /tmp/.weston_freeze # Freeze display
weston --tty=2 -B=drm-backend.so --idle-time=0

#解冻屏幕,在实际应用中,这块是在应用层删除
sleep 1 && rm /tmp/.weston_freeze& # Thaw in 1 second

3.动态的旋转屏幕

#如果需要动态配置屏幕方向,则可以使用动态配置文件,其中名字可以使用命令:ls /sys/class/drm/查看
echo "output:all:rotate90"> /tmp/.weston_drm.conf # All screens are rotated 90 degrees
echo "output:eDP-1:rotate180"> /tmp/.weston_drm.conf # eDP-1 rotate 180 degrees

4.屏幕的开关

#屏幕开
echo "compositor:state:on" > /tmp/.weston_drm.conf
#屏幕关
echo "compositor:state:off" > /tmp/.weston_drm.conf

5.参考文档

rk平台上weston的配置
weston设置

  • 1
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值