v4l2test: Fix the 'not support error' on null-display with mmap io_method.

Signed-off-by: Kevin.xie <kevin.xie@starfivetech.com>
This commit is contained in:
Kevin.xie
2022-07-29 16:08:25 +08:00
parent 933ef5f158
commit 70d68d9a99
+8 -6
View File
@@ -568,7 +568,8 @@ static void mainloop()
uint32_t nfds = 0; uint32_t nfds = 0;
LOG(STF_LEVEL_TRACE, "Enter\n"); LOG(STF_LEVEL_TRACE, "Enter\n");
if (STF_DISP_FB == gp_cfg_param->disp_type) { if (STF_DISP_FB == gp_cfg_param->disp_type ||
STF_DISP_NONE == gp_cfg_param->disp_type) {
// fb // fb
nfds = 1; nfds = 1;
fds = (struct pollfd*)malloc(sizeof(struct pollfd) * nfds); fds = (struct pollfd*)malloc(sizeof(struct pollfd) * nfds);
@@ -577,7 +578,7 @@ static void mainloop()
fds[0].events = POLLIN; fds[0].events = POLLIN;
} else if (STF_DISP_DRM == gp_cfg_param->disp_type && } else if (STF_DISP_DRM == gp_cfg_param->disp_type &&
IO_METHOD_MMAP == gp_cfg_param->io_mthd) { IO_METHOD_MMAP == gp_cfg_param->io_mthd) {
// drm + mmap // drm + mmap
nfds = 2; nfds = 2;
fds = (struct pollfd*)malloc(sizeof(struct pollfd) * nfds); fds = (struct pollfd*)malloc(sizeof(struct pollfd) * nfds);
@@ -593,7 +594,7 @@ static void mainloop()
ev.page_flip_handler = mmap_page_flip_handler; ev.page_flip_handler = mmap_page_flip_handler;
} else if (STF_DISP_DRM == gp_cfg_param->disp_type && } else if (STF_DISP_DRM == gp_cfg_param->disp_type &&
IO_METHOD_DMABUF == gp_cfg_param->io_mthd) { IO_METHOD_DMABUF == gp_cfg_param->io_mthd) {
// (drm + dmabuf) // (drm + dmabuf)
nfds = 2; nfds = 2;
fds = (struct pollfd*)malloc(sizeof(struct pollfd) * nfds); fds = (struct pollfd*)malloc(sizeof(struct pollfd) * nfds);
@@ -635,14 +636,15 @@ static void mainloop()
break; break;
} }
if (STF_DISP_FB == gp_cfg_param->disp_type) { if (STF_DISP_FB == gp_cfg_param->disp_type ||
STF_DISP_NONE == gp_cfg_param->disp_type) {
// fb // fb
if (fds[0].revents & POLLIN) { if (fds[0].revents & POLLIN) {
frameRead(); frameRead();
calc_frame_fps(); calc_frame_fps();
} }
} else if (STF_DISP_DRM == gp_cfg_param->disp_type && } else if (STF_DISP_DRM == gp_cfg_param->disp_type &&
IO_METHOD_MMAP == gp_cfg_param->io_mthd) { IO_METHOD_MMAP == gp_cfg_param->io_mthd) {
// drm + mmap // drm + mmap
if (fds[0].revents & POLLIN) { if (fds[0].revents & POLLIN) {
frameRead(); frameRead();
@@ -653,7 +655,7 @@ static void mainloop()
drmHandleEvent(gp_cfg_param->drm_param.fd, &ev); drmHandleEvent(gp_cfg_param->drm_param.fd, &ev);
} }
} else if (STF_DISP_DRM == gp_cfg_param->disp_type && } else if (STF_DISP_DRM == gp_cfg_param->disp_type &&
IO_METHOD_DMABUF == gp_cfg_param->io_mthd) { IO_METHOD_DMABUF == gp_cfg_param->io_mthd) {
// drm + dmabuf // drm + dmabuf
if (fds[0].revents & POLLIN) { if (fds[0].revents & POLLIN) {
int dequeued = stf_v4l2_dequeue_buffer(&gp_cfg_param->v4l2_param, &buf); int dequeued = stf_v4l2_dequeue_buffer(&gp_cfg_param->v4l2_param, &buf);