You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2023/01/02 09:27:24 UTC

[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8000: Change FIOC_MMAP, FIOC_MUNMAP and FIOC_TRUNCATE into file operation c…

xiaoxiang781216 commented on code in PR #8000:
URL: https://github.com/apache/nuttx/pull/8000#discussion_r1059914130


##########
drivers/video/fb.c:
##########
@@ -682,6 +675,30 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
   return ret;
 }
 
+static int     fb_mmap(FAR struct file *filep, FAR void **addr, off_t start,
+                       size_t length)
+{
+  FAR struct inode *inode;
+  FAR struct fb_chardev_s *fb;
+  int ret = -EINVAL;
+
+  /* Get the framebuffer instance */
+
+  DEBUGASSERT(filep != NULL && filep->f_inode != NULL);
+  inode = filep->f_inode;
+  fb    = (FAR struct fb_chardev_s *)inode->i_private;
+
+  /* Return the address corresponding to the start of frame buffer. */
+
+  if (addr)
+    {
+      *addr = fb->fbmem;

Review Comment:
   Before your change, FIOC_MMAP doesn't pass offset to the callback, so the driver can only return the start of buffer. But with the new mmap callback, the driver can adjust the returned value to consider offset required by caller.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org