1

Assume a hypothetical remote framebuffer protocol, implemented as a Linux framebuffer driver.

Could such a driver receive a notification when the framebuffer's memory was written-to directly from user space via an mmap mapping or similar?

https://elixir.bootlin.com/linux/v4.4/source/drivers/video/fbdev/skeletonfb.c#L653 shows all the functions a module writer can implement to get such information, but at first glance I could not see an implementation of xxxfb_mmap or xxxfb_write which would be possible candidates.


Update:

I've just seen fb_write at https://elixir.bootlin.com/linux/v4.4/source/drivers/video/fbdev/core/fbmem.c#L812

Will this be called only when the framebuffer is written to via a file-descriptor or also when its memory is written to via an mmapping?

I am looking for a way to only search for changes to an in-memory framebuffer when its contents have changed, rather than searching it continuously.

Community
  • 1
  • 1
fadedbee
  • 42,671
  • 44
  • 178
  • 308

1 Answers1

1

You can use Deferred IO, the steps are described here:

static void hecubafb_dpy_deferred_io(struct fb_info *info,
                                     struct list_head *pagelist)
{
}

static struct fb_deferred_io hecubafb_defio = {
    .delay       = HZ,
    .deferred_io = hecubafb_dpy_deferred_io,
};

// init
info->fbdefio = &hecubafb_defio;
fb_deferred_io_init(info);

// cleanup
fb_deferred_io_cleanup(info);
ebeneditos
  • 2,542
  • 1
  • 15
  • 35
ariprog
  • 81
  • 1