Read current framebuffer via DRM

I’m looking to access the content of the current screen frame-buffer in a manner that is independent of the window management ( X11, wayland).

So the obvious way seems to be via DRM, and there are samples in the L4T multimedia API that write to the display directly (see NvDrmRender ).

So the Idea is to get the current active CRTC and access its frame buffer:

// Open main DRM device:
int drm_fd = drmOpen("drm-nvdc", NULL);

drmModeRes* drmRes = drmModeGetResources(drm_fd);
// there is only one crtc, so pick the first one:
uint32_t drm_crtc_id = drmRes->crtcs[0];
//  drmModeCrtcPtr structure which contains information about the CRTC, such as the current framebuffer, mode,position, size, and number of gamma LUT elements.
drmModeCrtc* drm_crtc_info = drmModeGetCrtc(drm_fd, drm_crtc_id);
//  get the actual frame-buffer from the buffer-id
drmModeFB* crtc_FB = drmModeGetFB(drm_fd, drm_crtc_info->buffer_id); // ERROR: NULLPTR

But there doesn’t appear to be any FB:s to access!? How could that be when I’m rendering constantly to this display?


(gdb) p drmRes->count_fbs 
$5 = 0

Is “drm-nvdc” the correct display device to open for this use-case?

By default it is not supported. Please check the explanation in
NVFBC or equivalent api for jetson devices - #5 by DaneLLL

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.