Sample Header Ad - 728x90

drmModePageFlip() is failing when process started by systemd service

1 vote
1 answer
222 views
I created one Linux(STM32MP157 Olinuxino) application which uses DRM and OpenGL libs. The app is running without any issues when started from terminal. My application calls drmModePageFlip() twice with an interval of 1 second sometimes to show an effect like button click. I can see button click effect after 5 hours also when app is running in terminal. To start this app at boot time, I created a service as below and enabled it. [Unit] Description=ODRAW GUI Runtime After=systemd-user-sessions.service [Service] Type=simple Restart=always RestartSec=1 User=root ExecStart=/home/olimex/my_drm_app [Install] WantedBy=graphical.target Now the app is running immediately after Linux boots and I am unable to see the button click effect after 1 minute onwards. When I see the debug messages using **journalctl** I found that **drmModePageFlip()** failed when I call it second time for button click effect. And also during wait for flip completion I am getting user interruption. Below is the code for page flipping part. ret = drmModePageFlip(xDRM.fd, xDRM.crtc_id, gbm_fb->fb_id, DRM_MODE_PAGE_FLIP_EVENT, &waiting_for_flip); if(ret) { printf("failed to queue page flip: %s\n", strerror(errno)); } else { while(waiting_for_flip) { ret = select(xDRM.fd + 1, &fds, NULL, NULL, NULL); if (ret < 0) { printf("select err: %s\n", strerror(errno)); break;//return ret; } else if (ret == 0) { printf("select timeout!\n"); break;//return -1; } else if (FD_ISSET(0, &fds)) { printf("user interrupted!\n"); break; } drmHandleEvent(xDRM.fd, &evctx); } } Any idea to fix this issue will be helpful to me. Thanks in advance.
Asked by Yugandhar Babu (111 rep)
Jun 12, 2024, 12:53 PM
Last activity: Jul 16, 2024, 07:31 AM