This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 621bf54efc drivers/video/fb: fix poll event lost
621bf54efc is described below
commit 621bf54efc2229009dd784fb0835edd242871086
Author: pengyiqiang <[email protected]>
AuthorDate: Fri Feb 24 17:21:25 2023 +0800
drivers/video/fb: fix poll event lost
Signed-off-by: pengyiqiang <[email protected]>
---
drivers/video/fb.c | 18 ++++++++++++++++++
include/nuttx/video/fb.h | 6 ++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 6a1006220c..2a88e4f329 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -58,6 +58,7 @@ struct fb_chardev_s
size_t fblen; /* Size of the framebuffer */
uint8_t plane; /* Video plan number */
uint8_t bpp; /* Bits per pixel */
+ volatile bool pollready; /* Poll ready flag */
};
/****************************************************************************
@@ -160,6 +161,8 @@ static ssize_t fb_write(FAR struct file *filep, FAR const
char *buffer,
inode = filep->f_inode;
fb = (FAR struct fb_chardev_s *)inode->i_private;
+ fb->pollready = false;
+
/* Get the start and size of the transfer */
start = filep->f_pos;
@@ -526,6 +529,14 @@ static int fb_ioctl(FAR struct file *filep, int cmd,
unsigned long arg)
DEBUGASSERT(pinfo != NULL && fb->vtable != NULL &&
fb->vtable->pandisplay != NULL);
ret = fb->vtable->pandisplay(fb->vtable, pinfo);
+ fb->pollready = false;
+ }
+ break;
+
+ case FBIO_CLEARNOTIFY:
+ {
+ fb->pollready = false;
+ ret = OK;
}
break;
@@ -725,6 +736,11 @@ static int fb_poll(FAR struct file *filep, struct pollfd
*fds, bool setup)
{
return -EBUSY;
}
+
+ if (fb->pollready)
+ {
+ poll_notify(&fb->fds, 1, POLLOUT);
+ }
}
else if (fds->priv)
{
@@ -754,6 +770,8 @@ void fb_pollnotify(FAR struct fb_vtable_s *vtable)
fb = vtable->priv;
+ fb->pollready = true;
+
/* Notify framebuffer is writable. */
poll_notify(&fb->fds, 1, POLLOUT);
diff --git a/include/nuttx/video/fb.h b/include/nuttx/video/fb.h
index b77ffee45e..0db5d8b00b 100644
--- a/include/nuttx/video/fb.h
+++ b/include/nuttx/video/fb.h
@@ -286,12 +286,14 @@
* Argument: read-only struct
* fb_planeinfo_s* */
+#define FBIO_CLEARNOTIFY _FBIOC(0x0017) /* Clear notify signal */
+
/* Linux Support ************************************************************/
-#define FBIOGET_VSCREENINFO _FBIOC(0x0017) /* Get video variable info */
+#define FBIOGET_VSCREENINFO _FBIOC(0x0018) /* Get video variable info */
/* Argument: writable struct
* fb_var_screeninfo */
-#define FBIOGET_FSCREENINFO _FBIOC(0x0018) /* Get video fix info */
+#define FBIOGET_FSCREENINFO _FBIOC(0x0019) /* Get video fix info */
/* Argument: writable struct
* fb_fix_screeninfo */