您尚未登录。

楼主 # 2024-08-11 11:47:03

memory
会员
注册时间: 2021-08-11
已发帖子: 442
积分: 418

跟踪 A133 tplayerdemo播放视频遮住了 Qt5 widget界面

#
# cat /sys/class/disp/disp/attr/sys
screen 0:
de_rate 300000000 hz, ref_fps:59
mgr0: 720x1440 fmt[rgb] cs[0x204] range[full] eotf[0x4] bits[8bits] err[166] force_sync[0] unblank direct_show[false] iommu[1]

dmabuf: cache[0] cache max[0] umap skip[0] overflow[0]
        lcd output      backlight(100)  fps:59.9         720x1440
        err:1   skip:90 irq:3780659     vsync:0 vsync_skip:0

   BUF    enable ch[0] lyr[0] z[11] prem[N] a[pixel   0] fmt[ 77] fb[1088,1920; 544, 960; 544, 960] crop[   8,   0,1080,1920] frame[   0,   0, 400, 400] addr[fc800000,fc9fe000,fca7d800] flags[0x       0] trd[0,0] depth[ 0]

   BUF    enable ch[1] lyr[0] z[0] prem[N] a[globl 255] fmt[  0] fb[ 736,1440; 736,1440; 736,1440] crop[   0,   0, 720,1440] frame[   0,   0, 720,1440] addr[ff000000,       0,       0] flags[0x       0] trd[0,0] depth[ 0]

#
#

z[11]:视频层
z[0]:  UI层

z值越大,越处于上层,所以视频层遮住了视频播放层

离线

楼主 #1 2024-08-11 12:04:25

memory
会员
注册时间: 2021-08-11
已发帖子: 442
积分: 418

Re: 跟踪 A133 tplayerdemo播放视频遮住了 Qt5 widget界面

正常的T113板子是这样的:

root:/# cat /sys/class/disp/disp/attr/sys
screen 0:
de_rate 300000000 hz, ref_fps:58
mgr0: 1200x1920 fmt[rgb] cs[0x204] range[full] eotf[0x4] bits[8bits] err[10] force_sync[0] unblank direct_show[false] iommu[1]
dmabuf: cache[2] cache max[2] umap skip[0] umap skip max[20]
        lcd output      backlight(100)  fps:57.1        1200x1920
        err:0   skip:78 irq:3685        vsync:0 vsync_skip:0

BUF    enable ch[0] lyr[0] z[0] prem[N] a[globl 255] fmt[ 72] fb[1088,1920; 544, 960; 544, 960] crop[   8,   0,1080,1920] frame[   0,   0,1200,1920] addr[ 5700000, 597d800, 58fe000] flags[0x       0] trd[0,0]
depth[ 0]    

BUF    enable ch[1] lyr[0] z[16] prem[N] a[pixel 255] fmt[  0] fb[1200,1920;1200,1920;1200,1920] crop[   0,1920,1200,1920] frame[   0,   0,1200,1920] addr[       0,       0,       0] flags[0x       0] trd[0,0]
depth[ 0] 
root:/#
root:/#
root:/#

z[0]:视频层
z[16]:  UI层

层数字越大,就越处于顶层,所以UI会把视频层遮住,这个是正常逻辑。

离线

楼主 #2 2024-08-11 17:58:59

memory
会员
注册时间: 2021-08-11
已发帖子: 442
积分: 418

Re: 跟踪 A133 tplayerdemo播放视频遮住了 Qt5 widget界面

分析T113 SDK发现,UI处于16层的原因:

kernel/linux-5.4/drivers/video/fbdev/sunxi/disp2/disp/dev_fb.c

			config.info.mode = LAYER_MODE_BUFFER;
			config.info.zorder = 16;
			config.info.alpha_mode = 0;
			config.info.alpha_value = 0xff;
			config.info.fb.crop.x = (0LL) << 32;
			config.info.fb.crop.y = ((long long)y_offset) << 32;
			config.info.fb.crop.width =
			    ((long long)src_width) << 32;
			config.info.fb.crop.height =
			    ((long long)src_height) << 32;

播放器tplayer处于0的原因:
openwrt/package/allwinner/multimedia/tina_multimedia/tplayer/awsink/tlayer_ctrl.c

	lc->mDispOutPort->setRectFake(lc->mDispOutPort,&rect);
	lc->mDispOutPort->SetZorder(lc->mDispOutPort, VIDEO_ZORDER_BOTTOM);
	lc->mDispOutPort->setEnable(lc->mDispOutPort, 1);
	pthread_mutex_unlock(&configMtx);

platform/allwinner/display/libuapi/src/videoOutPort.c

static int layer_set_zorder(int fd, unsigned int hlay, int zorder) {
	disp_layer_info config;
	videoZorder layer_zorder = (videoZorder) zorder;
	if ((layer_zorder < VIDEO_ZORDER_TOP)
	        || (layer_zorder < VIDEO_ZORDER_TOP)) {
		DISP_DBG_LOG("(%s)invalid zorder\n", __FUNCTION__);
		return RET_FAIL;
	}
	memset(&config, 0, sizeof(disp_layer_info));
	LayerGetPara(fd, hlay, &config);
	switch (layer_zorder) {
	case VIDEO_ZORDER_TOP:
		config.zorder = ZORDER_MAX;
		break;
	case VIDEO_ZORDER_BOTTOM:
		config.zorder = ZORDER_MIN;
		break;
	default:
		break;
	}
	return LayerSetPara(fd, hlay, &config);
}
#define ZORDER_MIN 0
#define ZORDER_MID 5
#define ZORDER_MAX 11

最终决定播放器的层是 ZORDER_MIN,即0

屎山代码写得真烂

离线

楼主 #3 2024-08-11 21:53:04

memory
会员
注册时间: 2021-08-11
已发帖子: 442
积分: 418

Re: 跟踪 A133 tplayerdemo播放视频遮住了 Qt5 widget界面

A133 照上面修改,然后把文件lichee/linux-4.9/drivers/video/fbdev/sunxi/disp2/disp/dev_fb.c

			config.info.alpha_mode = 1;

修改成:

			config.info.alpha_mode = 0;

即可正常工作。

离线

楼主 #4 2024-08-12 11:48:48

memory
会员
注册时间: 2021-08-11
已发帖子: 442
积分: 418

Re: 跟踪 A133 tplayerdemo播放视频遮住了 Qt5 widget界面

UI开个小透明窗,让视频层显示出来:

    setAttribute(Qt::WA_TranslucentBackground);
    setWindowFlags(Qt::FramelessWindowHint);
void paintEvent(QPaintEvent *event) override
{        
	QPainter painter(this);// 创建一个 QPainter 对象
	painter.setRenderHint(QPainter::Antialiasing);

	painter.setBrush(Qt::white);
	painter.drawRect(rect()); //整个窗口刷白

	painter.setCompositionMode(QPainter::CompositionMode_Clear);
	QColor color(0, 0, 0, 0); // RGB 和 Alpha 值
	painter.setBrush(color);
	painter.drawRect(100, 100, 500, 500); // 绘制一个透明矩形
	painter.setCompositionMode(QPainter::CompositionMode_SourceOver);

	QWidget::paintEvent(event);// 调用基类的 paintEvent 处理其他默认绘制
}

离线

楼主 #5 2024-08-12 16:15:11

memory
会员
注册时间: 2021-08-11
已发帖子: 442
积分: 418

Re: 跟踪 A133 tplayerdemo播放视频遮住了 Qt5 widget界面

测试效果

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn