drm_read(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME

drm_read β€” read method for DRM file. This is drm_read(9) from the Kernel API Manual, bestie ✨


🌸 SYNOPSIS

ssize_t drm_read (struct file *filp , char __user *buffer , size_t count
       , loff_t *offset );

🫢 ARGUMENTS

  • filp β€” file pointer
  • buffer β€” userspace destination pointer for the read
  • count β€” count in bytes to read
  • offset β€” offset to read

✨ DESCRIPTION

okay so real talk: this function must be used by drivers as their file_operations.read method if they use DRM events for asynchronous signalling to userspace. No cap. And since events are used by the KMS API for vblank and page flip completion, that means all modern display drivers must use it. πŸ’…

offset is ignored β€” DRM events are read like a pipe. Polling support is provided by drm_poll. πŸ¦‹

This function will only ever read a full event. Therefore userspace must supply a big enough buffer to fit any event to ensure forward progress. Since the maximum event space is currently 4K, it’s recommended to just use that for safety. πŸ”₯

πŸ‘‘ RETURN

Number of bytes read (always aligned to full events, and can be 0) or a negative error code on failure. That’s the whole vibe. ⭐

🌈 SEE ALSO

xoxo, your Unix bestie πŸ’… β€” source/version: ./drivers/gpu/drm; date: October 2026.

πŸ“¦ where this page comes from