dri/drm/kms question with regards to minor faults

Bert Schiettecatte bert at noisetron.com
Wed Oct 27 00:18:47 UTC 2021


Hi All,

I have an application I'm working on where I'm using OpenGLES / EGL and dri/drm/kms. The main loop of my application looks like the code below. When running htop, I see that the number of minor faults (memory) are increasing over time at a rate of about 500 per second, due to the code below. Is this normal and something to worry about, and is there a way to get rid of the minor faults? I'm on the rockchip rk3288 platform. The faults do not come from my OpenGLES code. 

      while (true) {
                 struct gbm_bo *next_bo;
                 int waiting_for_flip = 1;
          
                 // do OpenGLES stuff ... 

                 eglSwapBuffers(gl.display, gl.surface);
                 next_bo = gbm_surface_lock_front_buffer(gbm.surface);
                 g_fb = drm_fb_get_from_bo(next_bo);

                 ret = drmModePageFlip(drm.fd, drm.crtc_id, g_fb->fb_id,
                                 DRM_MODE_PAGE_FLIP_EVENT, &waiting_for_flip);
                 if (ret) {
                         printf("failed to queue page flip: %s\n", strerror(errno));
                         return -1;
                 }

                 while (waiting_for_flip) {
                         ret = select(drm.fd + 1, &fds, NULL, NULL, NULL);
                         if (ret < 0) {
                                 printf("select err: %s\n", strerror(errno));
                                 return ret;
                         } else if (ret == 0) {
                                 printf("select timeout!\n");
                                 return -1;
                         } else if (FD_ISSET(0, &fds)) {
                                 printf("user interrupted!\n");
                                 break;
                         }
                         drmHandleEvent(drm.fd, &evctx);
                 }
                 gbm_surface_release_buffer(gbm.surface, g_bo);
                 g_bo = next_bo;
        }

Thanks!
Bert


More information about the dri-devel mailing list