From 201a57440c135c23cb71f7041ff8fc3f4580f282 Mon Sep 17 00:00:00 2001 From: jianglianfang Date: Tue, 22 Aug 2023 15:12:26 +0800 Subject: [PATCH] system/nxcamera: add pan_display when it is not single buffer. After optimizing the vync mechanism, it is necessary to use ioctl (display) to refresh the display in dual buffer mode. run nxcamera. Signed-off-by: jianglianfang --- system/nxcamera/nxcamera.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/system/nxcamera/nxcamera.c b/system/nxcamera/nxcamera.c index 006a899be..ed68caf53 100644 --- a/system/nxcamera/nxcamera.c +++ b/system/nxcamera/nxcamera.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -64,6 +65,25 @@ * Private Functions ****************************************************************************/ +/**************************************************************************** + * pan_display + ****************************************************************************/ + +static void pan_display(int fb_device, FAR struct fb_planeinfo_s *plane_info) +{ + struct pollfd pfd; + int ret; + pfd.fd = fb_device; + pfd.events = POLLOUT; + + ret = poll(&pfd, 1, 0); + + if (ret > 0) + { + ioctl(fb_device, FBIOPAN_DISPLAY, plane_info); + } +} + static int show_image(FAR struct nxcamera_s *pcam, FAR v4l2_buffer_t *buf) { #ifdef CONFIG_LIBYUV @@ -381,6 +401,11 @@ static void *nxcamera_loopthread(pthread_addr_t pvarg) goto err_out; } + if (pcam->display_pinfo.yres_virtual > pcam->display_vinfo.yres) + { + pan_display(pcam->display_fd, &pcam->display_pinfo); + } + ret = ioctl(pcam->capture_fd, VIDIOC_QBUF, (uintptr_t)&buf); if (ret < 0) {